From: Simon Hausmann Date: Mon, 12 Feb 2007 21:05:21 +0000 (+0100) Subject: When trying to map p4 integrations to git merges just record it as a single merge... X-Git-Tag: v1.5.3-rc0~65^2^2~205 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=930d3cc94e98ccecfa8762ef79f7c29af4a72769;p=git.git When trying to map p4 integrations to git merges just record it as a single merge with the newest p4 change as secondary parent. Signed-off-by: Simon Hausmann --- diff --git a/contrib/fast-import/p4-fast-export.py b/contrib/fast-import/p4-fast-export.py index 488533b07..0a3e5c993 100755 --- a/contrib/fast-import/p4-fast-export.py +++ b/contrib/fast-import/p4-fast-export.py @@ -172,7 +172,8 @@ def commit(details, files, branch, branchPrefix): gitStream.write("from %s\n" % initialParent) initialParent = "" - mergedBranches = set() + #mergedBranches = set() + merge = 0 for file in files: path = file["path"] @@ -202,13 +203,28 @@ def commit(details, files, branch, branchPrefix): if source.startswith(branchPrefix): continue - relPath = source[len(globalPrefix):] + lastSourceRev = log["erev0,0"] - for branch in knownBranches: - if relPath.startswith(branch) and branch not in mergedBranches: - gitStream.write("merge refs/heads/%s\n" % branch) - mergedBranches.add(branch) - break + sourceLog = p4CmdList("filelog -m 1 \"%s%s\"" % (source, lastSourceRev)) + if len(sourceLog) != 1: + print "eek! I got confused by the source filelog of %s%s" % (source, lastSourceRev) + sys.exit(1); + sourceLog = sourceLog[0] + + change = int(sourceLog["change0"]) + if change > merge: + merge = change + +# relPath = source[len(globalPrefix):] +# +# for branch in knownBranches: +# if relPath.startswith(branch) and branch not in mergedBranches: +# gitStream.write("merge refs/heads/%s\n" % branch) +# mergedBranches.add(branch) +# break + + if merge != 0: + gitStream.write("merge :%s\n" % merge) for file in files: path = file["path"]