aospa: build: tools: repopick: Add a way to checkout instead of cherrypick

This helps if you want to take a commit and its dependencies, and not
just a particular commit

Change-Id: Ib245cce560c7b0d6fd03198a8c69a13d4720a4cb
This commit is contained in:
OmniBot Auto Verifier 2013-10-16 13:24:22 +02:00 committed by Vishalcj17
parent e642bfac71
commit d6adb53dfe
No known key found for this signature in database
GPG Key ID: 5CB1A9F3F6539FB2
1 changed files with 6 additions and 2 deletions

View File

@ -173,6 +173,7 @@ if __name__ == '__main__':
branch in all repos first before performing any cherry picks.''')) branch in all repos first before performing any cherry picks.'''))
parser.add_argument('change_number', nargs='*', help='change number to cherry pick. Use {change number}/{patchset number} to get a specific revision.') parser.add_argument('change_number', nargs='*', help='change number to cherry pick. Use {change number}/{patchset number} to get a specific revision.')
parser.add_argument('-i', '--ignore-missing', action='store_true', help='do not error out if a patch applies to a missing directory') parser.add_argument('-i', '--ignore-missing', action='store_true', help='do not error out if a patch applies to a missing directory')
parser.add_argument('-ch', '--checkout', action='store_true', help='checkout instead of cherry pick')
parser.add_argument('-s', '--start-branch', nargs=1, help='start the specified branch before cherry picking') parser.add_argument('-s', '--start-branch', nargs=1, help='start the specified branch before cherry picking')
parser.add_argument('-r', '--reset', action='store_true', help='reset to initial state (abort cherry-pick) if there is a conflict') parser.add_argument('-r', '--reset', action='store_true', help='reset to initial state (abort cherry-pick) if there is a conflict')
parser.add_argument('-a', '--abandon-first', action='store_true', help='before cherry picking, abandon the branch specified in --start-branch') parser.add_argument('-a', '--abandon-first', action='store_true', help='before cherry picking, abandon the branch specified in --start-branch')
@ -460,8 +461,11 @@ if __name__ == '__main__':
if result != 0: if result != 0:
print('ERROR: git command failed') print('ERROR: git command failed')
sys.exit(result) sys.exit(result)
# Perform the cherry-pick # Perform the cherry-pick or checkout
if not args.pull: if not args.pull:
if args.checkout:
cmd = ['git checkout FETCH_HEAD']
else:
cmd = ['git cherry-pick --ff FETCH_HEAD'] cmd = ['git cherry-pick --ff FETCH_HEAD']
if args.quiet: if args.quiet:
cmd_out = open(os.devnull, 'wb') cmd_out = open(os.devnull, 'wb')