<feed xmlns='http://www.w3.org/2005/Atom'>
<title>tools/git-repo.git/subcmds/upload.py, branch v2.68</title>
<subtitle>Mirror of gerrit.googlesource.com/git-repo</subtitle>
<id>https://git.enea.com/cgit/tools/git-repo.git/atom?h=v2.68</id>
<link rel='self' href='https://git.enea.com/cgit/tools/git-repo.git/atom?h=v2.68'/>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/'/>
<updated>2026-09-09T19:10:24+00:00</updated>
<entry>
<title>upload: bypass branch editor with explicit branch and -y</title>
<updated>2026-09-09T19:10:24+00:00</updated>
<author>
<name>Arif Kasim</name>
<email>arifkasim@google.com</email>
</author>
<published>2026-08-27T02:03:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=fe2c23f8e2f00d6952a4e41f244f46598ba87461'/>
<id>urn:sha1:fe2c23f8e2f00d6952a4e41f244f46598ba87461</id>
<content type='text'>
When uploading across multiple projects with --yes and an explicit
branch specified (via --current-branch / -c or --branch / --br),
repo previously still opened the interactive branch selection editor.

If an explicit branch and --yes are provided, bypass the interactive
editor and upload all matching pending branches directly.

Bug: 553024110
Test: python3 -m pytest tests/
Test: flake8 subcmds/upload.py tests/test_subcmds_upload.py
Test: isort --check subcmds/upload.py tests/test_subcmds_upload.py
Change-Id: I104619603f6e0539d05b01d3eb0292a9145d58db
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/622661
Tested-by: Arif Kasim &lt;arifkasim@google.com&gt;
Reviewed-by: Gavin Mak &lt;gavinmak@google.com&gt;
</content>
</entry>
<entry>
<title>upload: reuse the worker current-branch result</title>
<updated>2026-09-03T00:45:55+00:00</updated>
<author>
<name>Gavin Mak</name>
<email>gavinmak@google.com</email>
</author>
<published>2026-08-25T16:01:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=d88ce8d9520fa9eeccc891151d40202999376599'/>
<id>urn:sha1:d88ce8d9520fa9eeccc891151d40202999376599</id>
<content type='text'>
Carry the current branch through _GatherOne so the parent can report a
failed current-branch upload without resolving HEAD a second time.

Bug: 553599402
Change-Id: I3fc54be6c10c30470e14f792ff68c0a396519327
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/623905
Reviewed-by: Brian Gan &lt;brgan@google.com&gt;
Commit-Queue: Gavin Mak &lt;gavinmak@google.com&gt;
Tested-by: Gavin Mak &lt;gavinmak@google.com&gt;
</content>
</entry>
<entry>
<title>upload: prune ref scans for untouched projects and specific branches</title>
<updated>2026-08-28T23:07:01+00:00</updated>
<author>
<name>James Hawkins</name>
<email>jhawkins@google.com</email>
</author>
<published>2026-08-28T08:19:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=e5bbb5c9e646a8c8068203596f628d20a7a58c43'/>
<id>urn:sha1:e5bbb5c9e646a8c8068203596f628d20a7a58c43</id>
<content type='text'>
Benchmark (100 untouched projects):
* GetUploadableBranches: 0.985s -&gt; 0.0004s (2,200x faster)
* repo upload (3,045 projects): saves ~2.5s of redundant ref scans

During `repo upload`, `GetUploadableBranches()` currently scans
`self._allrefs` across all projects in the workspace. In large
manifests (e.g. Android with 3,000+ projects), `self._allrefs`
executes `git for-each-ref`, `git symbolic-ref`, and full filesystem
mtime traversals on thousands of projects where no local branch was
ever started or modified.

Any branch that can be uploaded for review must have upstream tracking
configured via `[branch "..."]` sections in `.git/config`
(otherwise `branch.LocalMerge` is None and `GetUploadableBranch`
returns None).

This patch introduces early-pruning fast paths:
1. When no branch subsections exist in `.git/config`
   (or only 2-part keys like `branch.autosetupmerge`), return []
   immediately without touching `_allrefs`.
2. When a `selected_branch` is specified (e.g. `repo upload --br=...`),
   query `branch.LocalMerge`, `refs/heads/&lt;branch&gt;`, and
   `refs/published/&lt;branch&gt;` directly, skipping the whole-tree
   ref scan.
3. In `subcmds/upload.py`, optimize `_GetMergeBranch` to resolve the
   merge branch in-memory via `project.CurrentBranch` and
   `project.GetBranch()` instead of spawning two `GitCommand`
   processes.

Test: ./run_tests tests/test_project.py tests/test_subcmds_upload.py
Change-Id: I3c2c9d63a68a393d478e1fb50f548ec8b7d44639
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/623021
Reviewed-by: Brian Gan &lt;brgan@google.com&gt;
Commit-Queue: James Hawkins &lt;jhawkins@google.com&gt;
Tested-by: James Hawkins &lt;jhawkins@google.com&gt;
</content>
</entry>
<entry>
<title>hooks: add --fix option to auto-apply hook fixes</title>
<updated>2026-08-27T10:28:58+00:00</updated>
<author>
<name>Rahul Yadav</name>
<email>yadavrah@google.com</email>
</author>
<published>2026-08-14T15:09:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=e6ad7080098a0db0cb304812c8603856da2bebf2'/>
<id>urn:sha1:e6ad7080098a0db0cb304812c8603856da2bebf2</id>
<content type='text'>
Pass the --fix flag as a keyword argument "fix" to the hook main
function. This allows hooks (such as git-repohooks) to decouple
automated fix application from the -y/--yes flag so that -y can
answer yes to upload confirmation prompts without triggering file
mutations.

Companion change in git-repohooks:
https://gerrit-review.googlesource.com/c/git-repohooks/+/621761

Bug: 546510319
Test: python3 -m pytest tests/test_hooks.py

Change-Id: If0288d4791fc0a2aba6e88854e3aa81b0923b664
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/619281
Commit-Queue: Rahul Yadav &lt;yadavrah@google.com&gt;
Tested-by: Rahul Yadav &lt;yadavrah@google.com&gt;
Reviewed-by: Gavin Mak &lt;gavinmak@google.com&gt;
</content>
</entry>
<entry>
<title>Add detailed upload context to Trace2 telemetry</title>
<updated>2026-08-26T17:19:42+00:00</updated>
<author>
<name>Ram Peri</name>
<email>ramperi@google.com</email>
</author>
<published>2026-08-07T21:54:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=09914bcab7d1d5570c20a52d1861957145da8a5a'/>
<id>urn:sha1:09914bcab7d1d5570c20a52d1861957145da8a5a</id>
<content type='text'>
This patch intercepts the output during a successful upload
execution to capture the generated CL URLs. It logs a dynamically
constructed "repo.uploadstate" data event to the active trace2
log containing:
- Uploaded CL URLs
- Target remote name
- Source branch
- Modified files

Test:
1. ./run_tests
2. pytest tests/test_project.py
3. Manual verification:
- Created a dummy branch `test_upload_branch` in a project with local file changes.
- Invoked repo upload passing an explicit trace output directory:
  `repo --git-trace2-event-log=/tmp/trace2out upload --dry-run --no-verify art`
- Verified the injected payload successfully appeared on disk within the generated log:
  ```json
  {"event":"data",..."key":"repo.uploadstate/cls","value":""}
  {"event":"data",..."key":"repo.uploadstate/remote","value":"goog"}
  {"event":"data",..."key":"repo.uploadstate/branch","value":"test_upload_branch"}
  {"event":"data",..."key":"repo.uploadstate/files","value":"dummy_file.txt"}
  ```
  (cls is correctly blank on --dry-run but populates on real HTTP pushes)

Bug: 543953499
Change-Id: I9c402a32d01d156d42cf24eaa2e60e22710b5e6f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/616581
Reviewed-by: Gavin Mak &lt;gavinmak@google.com&gt;
Tested-by: Ram Peri &lt;ramperi@google.com&gt;
Commit-Queue: Ram Peri &lt;ramperi@google.com&gt;
</content>
</entry>
<entry>
<title>upload: Clarify partial sync message on hook failure</title>
<updated>2026-04-20T08:52:25+00:00</updated>
<author>
<name>Marty Heavey</name>
<email>mheavey@google.com</email>
</author>
<published>2026-04-17T11:14:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=32e7327ca6c420c5117e8b0eaa0219eb8f062d37'/>
<id>urn:sha1:32e7327ca6c420c5117e8b0eaa0219eb8f062d37</id>
<content type='text'>
Demote the partial sync warning from error to info and rephrase it to
be a tip rather than an error. This prevents users from thinking that
a partial sync is the cause of their hook failures when it is often a linting failure.

The message now suggests that a full sync might help if there are
cross-project dependencies, instead of implying it will fix any issue.

Change-Id: I5d8c52b53ac315aa9f145ed069798bf201fa0815
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/574262
Tested-by: Marty Heavey &lt;mheavey@google.com&gt;
Commit-Queue: Marty Heavey &lt;mheavey@google.com&gt;
Reviewed-by: Gavin Mak &lt;gavinmak@google.com&gt;
</content>
</entry>
<entry>
<title>Use git_superproject.UseSuperproject() everywhere</title>
<updated>2026-03-19T04:03:07+00:00</updated>
<author>
<name>Jacky Liu</name>
<email>qsliu@google.com</email>
</author>
<published>2026-03-16T05:07:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=0176586544d36d2902d6b8442ea4dc78e7921b8e'/>
<id>urn:sha1:0176586544d36d2902d6b8442ea4dc78e7921b8e</id>
<content type='text'>
Currently somewhere use git_superproject.UseSuperproject(), which checks
both the manifest config and user's config, and otherwhere use
manifest.manifestProject.use_superproject, which only checks the
manifest config. This causes Inconsistent behaviors for users who do not
set --use-superproject when doing repo init but have
repo.superprojectChoice in their git config.

Replace where using manifest.manifestProject.use_superproject with
git_superproject.UseSuperproject() to respect user's config and avoid
inconsistency.

Bug: 454514213
Change-Id: I1f734235cdd67b8a6915f1d05967d1aaa4d03f2a
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/561801
Commit-Queue: Jacky Liu &lt;qsliu@google.com&gt;
Reviewed-by: Mike Frysinger &lt;vapier@google.com&gt;
Tested-by: Jacky Liu &lt;qsliu@google.com&gt;
</content>
</entry>
<entry>
<title>upload: fix FileNotFoundError when no superproject</title>
<updated>2025-06-17T20:31:02+00:00</updated>
<author>
<name>Gavin Mak</name>
<email>gavinmak@google.com</email>
</author>
<published>2025-06-17T19:06:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=f91f4462e6365b5545b39be597dab23619b8d291'/>
<id>urn:sha1:f91f4462e6365b5545b39be597dab23619b8d291</id>
<content type='text'>
Upload gets a FileNotFoundError if not using superproject because it
tries to access the superproject's repo_id before checking if
superproject was actually enabled.

Reorder the logic to check use_superproject first.

Change-Id: I65cd2adab481e799dd7bb75e1a83553ad6e34d8d
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/484401
Tested-by: Gavin Mak &lt;gavinmak@google.com&gt;
Commit-Queue: Gavin Mak &lt;gavinmak@google.com&gt;
Reviewed-by: Mike Frysinger &lt;vapier@google.com&gt;
</content>
</entry>
<entry>
<title>subcmds: delete redundant dest= settings</title>
<updated>2025-05-27T16:26:43+00:00</updated>
<author>
<name>Mike Frysinger</name>
<email>vapier@google.com</email>
</author>
<published>2025-05-22T18:14:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=06338abe79f1fbef61f7297530ebf11139654d6c'/>
<id>urn:sha1:06338abe79f1fbef61f7297530ebf11139654d6c</id>
<content type='text'>
Add a test to enforce this too.

Change-Id: I80b5cf567aa33db9c24b53428c66d69f9c1d8d74
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/478481
Commit-Queue: Mike Frysinger &lt;vapier@google.com&gt;
Tested-by: Mike Frysinger &lt;vapier@google.com&gt;
Reviewed-by: Scott Lee &lt;ddoman@google.com&gt;
</content>
</entry>
<entry>
<title>upload: Add superproject identifier as push option</title>
<updated>2025-05-05T22:10:49+00:00</updated>
<author>
<name>Gavin Mak</name>
<email>gavinmak@google.com</email>
</author>
<published>2025-05-05T21:13:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=8d37f6147174fe170cc00a1d82b1cc5fe8ec0a7b'/>
<id>urn:sha1:8d37f6147174fe170cc00a1d82b1cc5fe8ec0a7b</id>
<content type='text'>
When uploading, add the root superproject repo as a push option in the
format `-o custom-keyed-value=rootRepo:$HOST/$PROJECT`.

Bug: b/401147338
Change-Id: I00230256eb7ae307b03840bb4090c28dc8a0505e
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/472601
Reviewed-by: Josip Sokcevic &lt;sokcevic@chromium.org&gt;
Tested-by: Gavin Mak &lt;gavinmak@google.com&gt;
Commit-Queue: Gavin Mak &lt;gavinmak@google.com&gt;
</content>
</entry>
</feed>
