summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorSimon Hausmann <simon@lst.de>2007-08-26 16:44:55 +0200
committerSimon Hausmann <simon@lst.de>2007-09-03 20:35:37 +0200
commit8134f69c21ff47283d8b3ea3cc5b306727cde256 (patch)
treef852888be854087883eb5d56a9f9ee671125cbd6 /contrib
parentc208a24310582d9cf337b66f41a0d7a9fe106bb4 (diff)
downloadgit-8134f69c21ff47283d8b3ea3cc5b306727cde256.tar.gz
git-p4: Cleanup; moved the (duplicated) code for turning a branch into a git ref (for example foo -> refs/remotes/p4/<project>/foo) into a separate method.
Signed-off-by: Simon Hausmann <simon@lst.de>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/fast-import/git-p428
1 files changed, 11 insertions, 17 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 2c67190ffc..406bec1a29 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -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:
@@ -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)