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 <simon@lst.de>
This commit is contained in:
Simon Hausmann 2007-02-12 22:05:21 +01:00
parent 77083daac7
commit 930d3cc94e

View File

@ -172,7 +172,8 @@ def commit(details, files, branch, branchPrefix):
gitStream.write("from %s\n" % initialParent) gitStream.write("from %s\n" % initialParent)
initialParent = "" initialParent = ""
mergedBranches = set() #mergedBranches = set()
merge = 0
for file in files: for file in files:
path = file["path"] path = file["path"]
@ -202,13 +203,28 @@ def commit(details, files, branch, branchPrefix):
if source.startswith(branchPrefix): if source.startswith(branchPrefix):
continue continue
relPath = source[len(globalPrefix):] lastSourceRev = log["erev0,0"]
for branch in knownBranches: sourceLog = p4CmdList("filelog -m 1 \"%s%s\"" % (source, lastSourceRev))
if relPath.startswith(branch) and branch not in mergedBranches: if len(sourceLog) != 1:
gitStream.write("merge refs/heads/%s\n" % branch) print "eek! I got confused by the source filelog of %s%s" % (source, lastSourceRev)
mergedBranches.add(branch) sys.exit(1);
break 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: for file in files:
path = file["path"] path = file["path"]