repopick: Warn about empty commits instead of failing
* If a cherry-pick results in an empty commit
(hints about git commit --allow-empty),
we should warn instead of failing all repopicks
Change-Id: I8410d7d02c4118c8072de609cf3c291e2d8523e6
This commit is contained in:
@@ -455,12 +455,19 @@ if __name__ == '__main__':
|
|||||||
cmd_out = None
|
cmd_out = None
|
||||||
result = subprocess.call(cmd, cwd=project_path, shell=True, stdout=cmd_out, stderr=cmd_out)
|
result = subprocess.call(cmd, cwd=project_path, shell=True, stdout=cmd_out, stderr=cmd_out)
|
||||||
if result != 0:
|
if result != 0:
|
||||||
if args.reset:
|
cmd = ['git diff-index --quiet HEAD --']
|
||||||
|
result = subprocess.call(cmd, cwd=project_path, shell=True, stdout=cmd_out, stderr=cmd_out)
|
||||||
|
if result == 0:
|
||||||
|
print('WARNING: git command resulted with an empty commit, aborting cherry-pick')
|
||||||
|
cmd = ['git cherry-pick --abort']
|
||||||
|
subprocess.call(cmd, cwd=project_path, shell=True, stdout=cmd_out, stderr=cmd_out)
|
||||||
|
elif args.reset:
|
||||||
print('ERROR: git command failed, aborting cherry-pick')
|
print('ERROR: git command failed, aborting cherry-pick')
|
||||||
cmd = ['git cherry-pick --abort']
|
cmd = ['git cherry-pick --abort']
|
||||||
subprocess.call(cmd, cwd=project_path, shell=True, stdout=cmd_out, stderr=cmd_out)
|
subprocess.call(cmd, cwd=project_path, shell=True, stdout=cmd_out, stderr=cmd_out)
|
||||||
|
sys.exit(result)
|
||||||
else:
|
else:
|
||||||
print('ERROR: git command failed')
|
print('ERROR: git command failed')
|
||||||
sys.exit(result)
|
sys.exit(result)
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
print('')
|
print('')
|
||||||
|
|||||||
Reference in New Issue
Block a user