git-p4: Cleanup, used common function for listing imported p4 branches

Signed-off-by: Simon Hausmann <simon@lst.de>
maint
Simon Hausmann 2007-07-18 17:27:50 +02:00
parent 86506fe54c
commit 144ff46b19
1 changed files with 5 additions and 21 deletions

View File

@ -1006,27 +1006,11 @@ class P4Sync(Command):
self.knownBranches[branch] = branch self.knownBranches[branch] = branch


def listExistingP4GitBranches(self): def listExistingP4GitBranches(self):
self.p4BranchesInGit = [] # branches holds mapping from name to commit

branches = p4BranchesInGit(self.importIntoRemotes)
cmdline = "git rev-parse --symbolic " self.p4BranchesInGit = branches.keys()
if self.importIntoRemotes: for branch in branches.keys():
cmdline += " --remotes" self.initialParents[self.refPrefix + branch] = branches[branch]
else:
cmdline += " --branches"

for line in read_pipe_lines(cmdline):
line = line.strip()

## only import to p4/
if not line.startswith('p4/') or line == "p4/HEAD":
continue
branch = line

# strip off p4
branch = re.sub ("^p4/", "", line)

self.p4BranchesInGit.append(branch)
self.initialParents[self.refPrefix + branch] = parseRevision(line)


def createOrUpdateBranchesFromOrigin(self): def createOrUpdateBranchesFromOrigin(self):
if not self.silent: if not self.silent: