]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git p4: inline listExistingP4GitBranches
authorPete Wyckoff <pw@padd.com>
Tue, 15 Jan 2013 00:46:58 +0000 (19:46 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Jan 2013 17:46:29 +0000 (09:46 -0800)
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>
git-p4.py

index de88680f2c5ada77d395f3cf0a2ac76da25ef98f..2443f79e07203475bd0cebe9dbfb0370b0ef2499 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -2512,13 +2512,6 @@ class P4Sync(Command, P4UserMap):
                 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:
@@ -2799,7 +2792,12 @@ class P4Sync(Command, P4UserMap):
         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: