summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorSimon Hausmann <shausman@trolltech.com>2007-06-17 09:25:34 (GMT)
committerSimon Hausmann <shausman@trolltech.com>2007-06-17 09:25:59 (GMT)
commit6555b2ccfe63913b3e5c8b02e117f0f476307ca2 (patch)
treee987c70f2371a2e46d8a1467919e27ba4aacdf5b /contrib
parentda4a660161cfe9d04c0849d77fa460c6ffc6503c (diff)
downloadgit-6555b2ccfe63913b3e5c8b02e117f0f476307ca2.zip
git-6555b2ccfe63913b3e5c8b02e117f0f476307ca2.tar.gz
git-6555b2ccfe63913b3e5c8b02e117f0f476307ca2.tar.bz2
Fix the branch mapping detection to be independent from the order of the "p4 branches" output.
Collect "unknown" source branches separately and register them at the end. Also added a minor speed up to splitFilesIntoBranches by breaking out of the loop through all branches when it's safe. Signed-off-by: Simon Hausmann <simon@lst.de>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/fast-import/git-p416
1 files changed, 13 insertions, 3 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index d1f8d3b..3b6d8a0 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -700,6 +700,7 @@ class P4Sync(Command):
if branch not in branches:
branches[branch] = []
branches[branch].append(file)
+ break
return branches
@@ -938,6 +939,8 @@ class P4Sync(Command):
return p
def getBranchMapping(self):
+ lostAndFoundBranches = set()
+
for info in p4CmdList("branches"):
details = p4Cmd("branch -o %s" % info["branch"])
viewIdx = 0
@@ -953,10 +956,17 @@ class P4Sync(Command):
if source.startswith(self.depotPaths[0]) and destination.startswith(self.depotPaths[0]):
source = source[len(self.depotPaths[0]):-4]
destination = destination[len(self.depotPaths[0]):-4]
- if destination not in self.knownBranches:
- self.knownBranches[destination] = source
+
+ self.knownBranches[destination] = source
+
+ lostAndFoundBranches.discard(destination)
+
if source not in self.knownBranches:
- self.knownBranches[source] = source
+ lostAndFoundBranches.add(source)
+
+
+ for branch in lostAndFoundBranches:
+ self.knownBranches[branch] = branch
def listExistingP4GitBranches(self):
self.p4BranchesInGit = []