repopick: Fix logic for skipping already merged changes
We can't iterate a list and update it at the same time. Test: Run `repopick -t XXI` twice Change-Id: I85651783531b59fd4b48d54a663c22cb243edac7
This commit is contained in:
@@ -548,7 +548,7 @@ def main():
|
|||||||
mergables[project_path].append(item)
|
mergables[project_path].append(item)
|
||||||
|
|
||||||
# round 1: start branch and drop picked changes
|
# round 1: start branch and drop picked changes
|
||||||
for project_path, per_path_mergables in mergables.items():
|
for project_path in mergables:
|
||||||
# If --start-branch is given, create the branch (more than once per path is okay; repo ignores gracefully)
|
# If --start-branch is given, create the branch (more than once per path is okay; repo ignores gracefully)
|
||||||
if args.start_branch:
|
if args.start_branch:
|
||||||
subprocess.run(["repo", "start", args.start_branch[0], project_path])
|
subprocess.run(["repo", "start", args.start_branch[0], project_path])
|
||||||
@@ -587,7 +587,7 @@ def main():
|
|||||||
picked_change_ids.append(head_change_id.strip())
|
picked_change_ids.append(head_change_id.strip())
|
||||||
break
|
break
|
||||||
|
|
||||||
for item in per_path_mergables:
|
def filter_picked(item):
|
||||||
# Check if change is already picked to HEAD...HEAD~check_picked_count
|
# Check if change is already picked to HEAD...HEAD~check_picked_count
|
||||||
if item["change_id"] in picked_change_ids:
|
if item["change_id"] in picked_change_ids:
|
||||||
print(
|
print(
|
||||||
@@ -595,7 +595,10 @@ def main():
|
|||||||
item["id"], project_path
|
item["id"], project_path
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
per_path_mergables.remove(item)
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
mergables[project_path] = list(filter(filter_picked, mergables[project_path]))
|
||||||
|
|
||||||
# round 2: fetch changes in parallel if not pull
|
# round 2: fetch changes in parallel if not pull
|
||||||
if not args.pull:
|
if not args.pull:
|
||||||
|
Reference in New Issue
Block a user