summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2013-01-15 00:47:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-01-15 17:46:30 (GMT)
commit8c9e8b6e756cce90797e19dc64e3b51426546cf3 (patch)
tree98b4029c4be49401300478584af1d4896f46b80b /git-p4.py
parent5a8e84cde3711076d3ad7260daa0a24ee40c8e07 (diff)
downloadgit-8c9e8b6e756cce90797e19dc64e3b51426546cf3.zip
git-8c9e8b6e756cce90797e19dc64e3b51426546cf3.tar.gz
git-8c9e8b6e756cce90797e19dc64e3b51426546cf3.tar.bz2
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-xgit-p4.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/git-p4.py b/git-p4.py
index 7b71ceb..9ea1905 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -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