summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2007-11-18 16:03:58 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2007-11-18 16:03:58 -0800
commitffa06873d62bba358b51b43def2a0b3aefc790bf (patch)
tree727fd84049b057ff2d8a48dd4b601fc249e27619
parentMerge branch 'lt/rev-list-interactive' (diff)
parentgit-p4: Fix direct import from perforce after fetching changes through git fr... (diff)
downloadtgif-ffa06873d62bba358b51b43def2a0b3aefc790bf.tar.xz
Merge branch 'sh/p4'
* sh/p4: git-p4: Fix direct import from perforce after fetching changes through git from origin
-rwxr-xr-xcontrib/fast-import/git-p415
1 files changed, 13 insertions, 2 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index c148b5ab7d..c869bb8864 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -1207,6 +1207,15 @@ class P4Sync(Command):
for branch in lostAndFoundBranches:
self.knownBranches[branch] = branch
+ def getBranchMappingFromGitBranches(self):
+ branches = p4BranchesInGit(self.importIntoRemotes)
+ for branch in branches.keys():
+ if branch == "master":
+ branch = "main"
+ else:
+ branch = branch[len(self.projectName):]
+ self.knownBranches[branch] = branch
+
def listExistingP4GitBranches(self):
# branches holds mapping from name to commit
branches = p4BranchesInGit(self.importIntoRemotes)
@@ -1541,8 +1550,10 @@ class P4Sync(Command):
## FIXME - what's a P4 projectName ?
self.projectName = self.guessProjectName()
- if not self.hasOrigin:
- self.getBranchMapping();
+ if self.hasOrigin:
+ self.getBranchMappingFromGitBranches()
+ else:
+ self.getBranchMapping()
if self.verbose:
print "p4-git branches: %s" % self.p4BranchesInGit
print "initial parents: %s" % self.initialParents