git-p4: Cleanup, used common function for listing imported p4 branches
Signed-off-by: Simon Hausmann <simon@lst.de>
Simon Hausmann committed
Jul 18, 2007 at 17:27 UTC
144ff46b196e49fd52b2ecf0aaa1db4c190393b9
1 file changed
+5
-21
contrib/fast-import/git-p4
+5
-21
@@ -1006,27 +1006,11 @@ class P4Sync(Command):
1006
self.knownBranches[branch] = branch
1007
1008
def listExistingP4GitBranches(self):
1009
- self.p4BranchesInGit = []
1010
-
1011
- cmdline = "git rev-parse --symbolic "
1012
- if self.importIntoRemotes:
1013
- cmdline += " --remotes"
1014
- else:
1015
- cmdline += " --branches"
1016
-
1017
- for line in read_pipe_lines(cmdline):
1018
- line = line.strip()
1019
-
1020
- ## only import to p4/
1021
- if not line.startswith('p4/') or line == "p4/HEAD":
1022
- continue
1023
- branch = line
1024
-
1025
- # strip off p4
1026
- branch = re.sub ("^p4/", "", line)
1027
-
1028
- self.p4BranchesInGit.append(branch)
1029
- self.initialParents[self.refPrefix + branch] = parseRevision(line)
1009
+ # branches holds mapping from name to commit
1010
+ branches = p4BranchesInGit(self.importIntoRemotes)
1011
+ self.p4BranchesInGit = branches.keys()
1012
+ for branch in branches.keys():
1013
+ self.initialParents[self.refPrefix + branch] = branches[branch]
1014
1015
def createOrUpdateBranchesFromOrigin(self):
1016
if not self.silent: