Skip to content

Commit

Permalink
repopick: don't re-pick duplicate changes
Browse files Browse the repository at this point in the history
check the last 10 commits to HEAD for a dupe change id.

Change-Id: Icfbf8b4eae165cf84ef4a82f54f792e9c9acd67b
  • Loading branch information
fourkbomb authored and LorDClockaN committed Aug 28, 2016
1 parent 64987e9 commit 0e8f496
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/repopick.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def fetch_query(remote_url, query):
'subject': review['subject'],
'project': review['project'],
'branch': review['branch'],
'change_id': review['change_id'],
'change_number': review['number'],
'status': review['status'],
'fetch': None
Expand Down Expand Up @@ -317,6 +318,19 @@ def fetch_query(remote_url, query):
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']))
Expand Down

0 comments on commit 0e8f496

Please sign in to comment.