mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
rebase/sync: use exit(1) for errors instead of exit(-1)
Callers don't actually see -1 (they'll usually see 255, but the exact answer here is complicated). Just switch to 1 as that's the standard value tools use to indicate an error. Change-Id: Ib712db1924bc3e5f7920bafd7bb5fb61f3bda44f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/233553 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
a34186e481
commit
a850ca2712
@ -71,7 +71,7 @@ branch but need to incorporate new upstream changes "underneath" them.
|
|||||||
if len(args) == 1:
|
if len(args) == 1:
|
||||||
print('note: project %s is mapped to more than one path' % (args[0],),
|
print('note: project %s is mapped to more than one path' % (args[0],),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
return -1
|
return 1
|
||||||
|
|
||||||
for project in all_projects:
|
for project in all_projects:
|
||||||
cb = project.CurrentBranch
|
cb = project.CurrentBranch
|
||||||
@ -79,7 +79,7 @@ branch but need to incorporate new upstream changes "underneath" them.
|
|||||||
if one_project:
|
if one_project:
|
||||||
print("error: project %s has a detached HEAD" % project.relpath,
|
print("error: project %s has a detached HEAD" % project.relpath,
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
return -1
|
return 1
|
||||||
# ignore branches with detatched HEADs
|
# ignore branches with detatched HEADs
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ branch but need to incorporate new upstream changes "underneath" them.
|
|||||||
if one_project:
|
if one_project:
|
||||||
print("error: project %s does not track any remote branches"
|
print("error: project %s does not track any remote branches"
|
||||||
% project.relpath, file=sys.stderr)
|
% project.relpath, file=sys.stderr)
|
||||||
return -1
|
return 1
|
||||||
# ignore branches without remotes
|
# ignore branches without remotes
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -131,13 +131,13 @@ branch but need to incorporate new upstream changes "underneath" them.
|
|||||||
stash_args = ["stash"]
|
stash_args = ["stash"]
|
||||||
|
|
||||||
if GitCommand(project, stash_args).Wait() != 0:
|
if GitCommand(project, stash_args).Wait() != 0:
|
||||||
return -1
|
return 1
|
||||||
|
|
||||||
if GitCommand(project, args).Wait() != 0:
|
if GitCommand(project, args).Wait() != 0:
|
||||||
return -1
|
return 1
|
||||||
|
|
||||||
if needs_stash:
|
if needs_stash:
|
||||||
stash_args.append('pop')
|
stash_args.append('pop')
|
||||||
stash_args.append('--quiet')
|
stash_args.append('--quiet')
|
||||||
if GitCommand(project, stash_args).Wait() != 0:
|
if GitCommand(project, stash_args).Wait() != 0:
|
||||||
return -1
|
return 1
|
||||||
|
@ -635,7 +635,7 @@ later is required to fix a server side protocol bug.
|
|||||||
print('Failed to remove %s (%s)' % (os.path.join(path, '.git'), str(e)), file=sys.stderr)
|
print('Failed to remove %s (%s)' % (os.path.join(path, '.git'), str(e)), file=sys.stderr)
|
||||||
print('error: Failed to delete obsolete path %s' % path, file=sys.stderr)
|
print('error: Failed to delete obsolete path %s' % path, file=sys.stderr)
|
||||||
print(' remove manually, then run sync again', file=sys.stderr)
|
print(' remove manually, then run sync again', file=sys.stderr)
|
||||||
return -1
|
return 1
|
||||||
|
|
||||||
# Delete everything under the worktree, except for directories that contain
|
# Delete everything under the worktree, except for directories that contain
|
||||||
# another git project
|
# another git project
|
||||||
@ -669,7 +669,7 @@ later is required to fix a server side protocol bug.
|
|||||||
if failed:
|
if failed:
|
||||||
print('error: Failed to delete obsolete path %s' % path, file=sys.stderr)
|
print('error: Failed to delete obsolete path %s' % path, file=sys.stderr)
|
||||||
print(' remove manually, then run sync again', file=sys.stderr)
|
print(' remove manually, then run sync again', file=sys.stderr)
|
||||||
return -1
|
return 1
|
||||||
|
|
||||||
# Try deleting parent dirs if they are empty
|
# Try deleting parent dirs if they are empty
|
||||||
project_dir = path
|
project_dir = path
|
||||||
@ -726,9 +726,9 @@ later is required to fix a server side protocol bug.
|
|||||||
'are present' % project.relpath, file=sys.stderr)
|
'are present' % project.relpath, file=sys.stderr)
|
||||||
print(' commit changes, then run sync again',
|
print(' commit changes, then run sync again',
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
return -1
|
return 1
|
||||||
elif self._DeleteProject(project.worktree):
|
elif self._DeleteProject(project.worktree):
|
||||||
return -1
|
return 1
|
||||||
|
|
||||||
new_project_paths.sort()
|
new_project_paths.sort()
|
||||||
fd = open(file_path, 'w')
|
fd = open(file_path, 'w')
|
||||||
|
Loading…
Reference in New Issue
Block a user