From: Pete Wyckoff Date: Wed, 18 Feb 2009 18:12:14 +0000 (-0500) Subject: git-p4: avoid syncing duplicate changes X-Git-Tag: v1.6.2-rc2~15 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b4b0ba06f8748348039d56ffa5890590dd9776ee;p=git.git 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 Acked-by: Simon Hausmann Signed-off-by: Junio C Hamano --- diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index a85a7b2a5..3832f6022 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -442,13 +442,14 @@ def p4ChangesForPaths(depotPaths, changeRange): output = p4_read_pipe_lines("changes " + ' '.join (["%s...%s" % (p, changeRange) for p in depotPaths])) - changes = [] + changes = {} for line in output: - changeNum = line.split(" ")[1] - changes.append(int(changeNum)) + changeNum = int(line.split(" ")[1]) + changes[changeNum] = True - changes.sort() - return changes + changelist = changes.keys() + changelist.sort() + return changelist class Command: def __init__(self):