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:
LuK1337
2024-02-08 13:47:41 +01:00
parent 2869dc1de1
commit 92ced50692

View File

@@ -548,7 +548,7 @@ def main():
mergables[project_path].append(item)
# 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 args.start_branch:
subprocess.run(["repo", "start", args.start_branch[0], project_path])
@@ -587,7 +587,7 @@ def main():
picked_change_ids.append(head_change_id.strip())
break
for item in per_path_mergables:
def filter_picked(item):
# Check if change is already picked to HEAD...HEAD~check_picked_count
if item["change_id"] in picked_change_ids:
print(
@@ -595,7 +595,10 @@ def main():
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
if not args.pull: