Skip to content

Commit

Permalink
Merge branch 'sh/p4'
Browse files Browse the repository at this point in the history
* sh/p4:
  git-p4: Fix direct import from perforce after fetching changes through git from origin
  • Loading branch information
Junio C Hamano committed Nov 19, 2007
2 parents 761e856 + 38f9f5e commit ffa0687
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ffa0687

Please sign in to comment.