@matheusbsbs / matheus-bagliano / commits / d414c74afd
Fork 0

Shortcut the case where we have no origin branch

Signed-off-by: Simon Hausmann <shausman@trolltech.com>

Simon Hausmann committed May 25, 2007 at 11:36 UTC d414c74afd8610c8c22dadf62b5ba8c6efa59e75
1 file changed +4 -2
contrib/fast-import/git-p4
+4 -2
@@ -844,6 +844,7 @@ class P4Sync(Command):
844 # map from branch depot path to parent branch
845 self.knownBranches = {}
846 self.initialParents = {}
847 + self.hasOrigin = gitBranchExists("origin")
848
849 if self.importIntoRemotes:
850 self.refPrefix = "refs/remotes/p4/"
@@ -851,7 +852,7 @@ class P4Sync(Command):
852 self.refPrefix = "refs/heads/"
853
854 if self.syncWithOrigin:
854 - if gitBranchExists("origin"):
855 + if self.hasOrigin:
856 if not self.silent:
857 print "Syncing with origin first by calling git fetch origin"
858 system("git fetch origin")
@@ -868,7 +869,8 @@ class P4Sync(Command):
869 createP4HeadRef = True
870
871 if len(args) == 0:
871 - self.createOrUpdateBranchesFromOrigin()
872 + if self.hasOrigin:
873 + self.createOrUpdateBranchesFromOrigin()
874 self.listExistingP4GitBranches()
875
876 if len(self.p4BranchesInGit) > 1: