Skip to content

Commit b4b0ba0

Browse files
Pete Wyckoffgitster
authored andcommitted
git-p4: avoid syncing duplicate changes
When a particular changeset affects multiple depot paths, it will appear multiple times in the output of "p4 changes". Filter out the duplicates to avoid the extra empty commits that this otherwise would create. Signed-off-by: Pete Wyckoff <[email protected]> Acked-by: Simon Hausmann <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2d602e9 commit b4b0ba0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

contrib/fast-import/git-p4

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,13 +442,14 @@ def p4ChangesForPaths(depotPaths, changeRange):
442442
output = p4_read_pipe_lines("changes " + ' '.join (["%s...%s" % (p, changeRange)
443443
for p in depotPaths]))
444444

445-
changes = []
445+
changes = {}
446446
for line in output:
447-
changeNum = line.split(" ")[1]
448-
changes.append(int(changeNum))
447+
changeNum = int(line.split(" ")[1])
448+
changes[changeNum] = True
449449

450-
changes.sort()
451-
return changes
450+
changelist = changes.keys()
451+
changelist.sort()
452+
return changelist
452453

453454
class Command:
454455
def __init__(self):

0 commit comments

Comments
 (0)