diff options
author | Simon Shields <keepcalm444@gmail.com> | 2016-08-27 01:49:14 +1000 |
---|---|---|
committer | Adrian DC <radian.dc@gmail.com> | 2016-12-04 12:04:36 +0100 |
commit | e5be2a0b233ff0482ba36894de5da57b663dc683 (patch) | |
tree | 3f0d2b751c2d0c3ea7a2b533e19e819d552e07c8 /tools | |
parent | 9aa34c95a61c57512cc7973740c34ab3e61983c5 (diff) | |
download | build-e5be2a0b233ff0482ba36894de5da57b663dc683.zip build-e5be2a0b233ff0482ba36894de5da57b663dc683.tar.gz build-e5be2a0b233ff0482ba36894de5da57b663dc683.tar.bz2 |
repopick: don't re-pick duplicate changes
check the last 10 commits to HEAD for a dupe change id.
RM-290
Change-Id: Icfbf8b4eae165cf84ef4a82f54f792e9c9acd67b
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/repopick.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/repopick.py b/tools/repopick.py index 2b0aab4..6e40f38 100755 --- a/tools/repopick.py +++ b/tools/repopick.py @@ -275,6 +275,7 @@ if __name__ == '__main__': 'subject': review['subject'], 'project': review['project'], 'branch': review['branch'], + 'change_id': review['change_id'], 'change_number': review['number'], 'status': review['status'], 'fetch': None @@ -317,6 +318,19 @@ if __name__ == '__main__': if args.start_branch: subprocess.check_output(['repo', 'start', args.start_branch[0], project_path]) + # Check if change is already picked to HEAD...HEAD~10 + found_change = False + for i in range(0, 10): + output = subprocess.check_output(['git', 'show', '-q', 'HEAD~{0}'.format(i)], cwd=project_path).split() + if 'Change-Id:' in output: + head_change_id = output[output.index('Change-Id:')+1] + if head_change_id.strip() == item['change_id']: + print('Skipping {0} - already picked in {1} as HEAD~{2}'.format(item['id'], project_path, i)) + found_change = True + break + if found_change: + continue + # Print out some useful info if not args.quiet: print('--> Subject: "{0}"'.format(item['subject'])) |