Skip to content

Commit

Permalink
git-p4: Allow filtering Perforce branches by user
Browse files Browse the repository at this point in the history
All branches in the Perforce server are downloaded to allow branch detection. If
you have a centralized server on a remote location and there is a big number of
branches this operation can take some time.
This patch adds the configuration option git-p4.branchUser to allow filtering
the branch list by user. Although this limits the branch maintenance in Perforce
to be done by a single user, it might be an advantage when the number of
branches being used in a specific depot is very small when compared with the
branches available in the server.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Vitor Antunes authored and Junio C Hamano committed Aug 23, 2011
1 parent 04d277b commit 8ace74c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,13 @@ class P4Sync(Command, P4UserMap):
def getBranchMapping(self):
lostAndFoundBranches = set()

for info in p4CmdList("branches"):
user = gitConfig("git-p4.branchUser")
if len(user) > 0:
command = "branches -u %s" % user
else:
command = "branches"

for info in p4CmdList(command):
details = p4Cmd("branch -o %s" % info["branch"])
viewIdx = 0
while details.has_key("View%s" % viewIdx):
Expand Down
6 changes: 6 additions & 0 deletions contrib/fast-import/git-p4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ Perforce server. Will enable --find-copies-harder git argument.

git config [--global] git-p4.detectCopies true

git-p4.branchUser

Only use branch specifications defined by the selected username.

git config [--global] git-p4.branchUser username

Implementation Details...
=========================

Expand Down

0 comments on commit 8ace74c

Please sign in to comment.