Skip to content

Commit

Permalink
git-p4: Cleanup; moved the (duplicated) code for turning a branch int…
Browse files Browse the repository at this point in the history
…o a git ref (for example foo -> refs/remotes/p4/<project>/foo) into a separate method.

Signed-off-by: Simon Hausmann <simon@lst.de>
  • Loading branch information
Simon Hausmann committed Sep 3, 2007
1 parent c208a24 commit 8134f69
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,15 @@ class P4Sync(Command):
self.keepRepoPath = (d.has_key('options')
and ('keepRepoPath' in d['options']))

def gitRefForBranch(self, branch):
if branch == "main":
return self.refPrefix + "master"

if len(branch) <= 0:
return branch

return self.refPrefix + self.projectName + branch

def importChanges(self, changes):
cnt = 1
for change in changes:
Expand Down Expand Up @@ -1153,23 +1162,8 @@ class P4Sync(Command):
elif self.verbose:
print "parent determined through known branches: %s" % parent

# main branch? use master
if branch == "main":
branch = "master"
else:

## FIXME
branch = self.projectName + branch

if parent == "main":
parent = "master"
elif len(parent) > 0:
## FIXME
parent = self.projectName + parent

branch = self.refPrefix + branch
if len(parent) > 0:
parent = self.refPrefix + parent
branch = self.gitRefForBranch(branch)
parent = self.gitRefForBranch(parent)

if self.verbose:
print "looking for initial parent for %s; current parent is %s" % (branch, parent)
Expand Down

0 comments on commit 8134f69

Please sign in to comment.