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 <pw@padd.com> Acked-by: Simon Hausmann <simon@lst.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pete Wyckoff committed
Feb 18, 2009 at 13:12 UTC
b4b0ba06f8748348039d56ffa5890590dd9776ee
1 file changed
+6
-5
contrib/fast-import/git-p4
+6
-5
@@ -442,13 +442,14 @@ def p4ChangesForPaths(depotPaths, changeRange):
442
output = p4_read_pipe_lines("changes " + ' '.join (["%s...%s" % (p, changeRange)
443
for p in depotPaths]))
444
445
- changes = []
445
+ changes = {}
446
for line in output:
447
- changeNum = line.split(" ")[1]
448
- changes.append(int(changeNum))
447
+ changeNum = int(line.split(" ")[1])
448
+ changes[changeNum] = True
449
450
- changes.sort()
451
- return changes
450
+ changelist = changes.keys()
451
+ changelist.sort()
452
+ return changelist
453
454
class Command:
455
def __init__(self):