Skip to content

Commit

Permalink
git p4: inline listExistingP4GitBranches
Browse files Browse the repository at this point in the history
It is four lines of code used in only one place.  Simplify by
including it where it is used.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Pete Wyckoff authored and Junio C Hamano committed Jan 15, 2013
1 parent 2c8037e commit 3b650fc
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions git-p4.py
Original file line number Diff line number Diff line change
Expand Up @@ -2512,13 +2512,6 @@ def getBranchMappingFromGitBranches(self):
branch = branch[len(self.projectName):]
self.knownBranches[branch] = branch

def listExistingP4GitBranches(self):
# branches holds mapping from name to commit
branches = p4BranchesInGit(self.importIntoRemotes)
self.p4BranchesInGit = branches.keys()
for branch in branches.keys():
self.initialParents[self.refPrefix + branch] = branches[branch]

def updateOptionDict(self, d):
option_keys = {}
if self.keepRepoPath:
Expand Down Expand Up @@ -2799,7 +2792,12 @@ def run(self, args):
if args == []:
if self.hasOrigin:
createOrUpdateBranchesFromOrigin(self.refPrefix, self.silent)
self.listExistingP4GitBranches()

# branches holds mapping from branch name to sha1
branches = p4BranchesInGit(self.importIntoRemotes)
self.p4BranchesInGit = branches.keys()
for branch in branches.keys():
self.initialParents[self.refPrefix + branch] = branches[branch]

if len(self.p4BranchesInGit) > 1:
if not self.silent:
Expand Down

0 comments on commit 3b650fc

Please sign in to comment.