diff options
author | Pete Wyckoff <pw@padd.com> | 2013-01-14 19:47:06 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-01-15 09:46:30 -0800 |
commit | 8c9e8b6e756cce90797e19dc64e3b51426546cf3 (patch) | |
tree | 98b4029c4be49401300478584af1d4896f46b80b /git-p4.py | |
parent | 5a8e84cde3711076d3ad7260daa0a24ee40c8e07 (diff) | |
download | git-8c9e8b6e756cce90797e19dc64e3b51426546cf3.tar.gz |
git p4: fix sync --branch when no master branch
It is legal to sync a branch with a different name than
refs/remotes/p4/master, and to do so even when master does
not exist.
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-x | git-p4.py | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -2804,14 +2804,22 @@ class P4Sync(Command, P4UserMap): # 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] + + # restrict to just this one, disabling detect-branches + if branch_arg_given: + short = self.branch.split("/")[-1] + if short in branches: + self.p4BranchesInGit = [ short ] + else: + self.p4BranchesInGit = branches.keys() if len(self.p4BranchesInGit) > 1: if not self.silent: print "Importing from/into multiple branches" self.detectBranches = True + for branch in branches.keys(): + self.initialParents[self.refPrefix + branch] = \ + branches[branch] if self.verbose: print "branches: %s" % self.p4BranchesInGit |