Skip to content

Commit f91f446

Browse files
gavinmakLUCI
authored andcommitted
upload: fix FileNotFoundError when no superproject
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 <[email protected]> Commit-Queue: Gavin Mak <[email protected]> Reviewed-by: Mike Frysinger <[email protected]>
1 parent 8535282 commit f91f446

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

subcmds/upload.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,12 @@ def _ExpandCommaList(value):
627627
# If using superproject, add the root repo as a push option.
628628
manifest = branch.project.manifest
629629
push_options = list(opt.push_options)
630-
sp = manifest.superproject
631-
if sp and sp.repo_id and manifest.manifestProject.use_superproject:
632-
push_options.append(f"custom-keyed-value=rootRepo:{sp.repo_id}")
630+
if manifest.manifestProject.use_superproject:
631+
sp = manifest.superproject
632+
if sp:
633+
r_id = sp.repo_id
634+
if r_id:
635+
push_options.append(f"custom-keyed-value=rootRepo:{r_id}")
633636

634637
branch.UploadForReview(
635638
people,

0 commit comments

Comments
 (0)