Merge branch 'sh/p4'

* sh/p4:
  git-p4: Fix direct import from perforce after fetching changes through git from origin
This commit is contained in:
Junio C Hamano 2007-11-18 16:03:58 -08:00
commit ffa06873d6

View File

@ -1207,6 +1207,15 @@ class P4Sync(Command):
for branch in lostAndFoundBranches: for branch in lostAndFoundBranches:
self.knownBranches[branch] = branch 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): def listExistingP4GitBranches(self):
# branches holds mapping from name to commit # branches holds mapping from name to commit
branches = p4BranchesInGit(self.importIntoRemotes) branches = p4BranchesInGit(self.importIntoRemotes)
@ -1541,8 +1550,10 @@ class P4Sync(Command):
## FIXME - what's a P4 projectName ? ## FIXME - what's a P4 projectName ?
self.projectName = self.guessProjectName() self.projectName = self.guessProjectName()
if not self.hasOrigin: if self.hasOrigin:
self.getBranchMapping(); self.getBranchMappingFromGitBranches()
else:
self.getBranchMapping()
if self.verbose: if self.verbose:
print "p4-git branches: %s" % self.p4BranchesInGit print "p4-git branches: %s" % self.p4BranchesInGit
print "initial parents: %s" % self.initialParents print "initial parents: %s" % self.initialParents