Skip to content

Commit 8ace74c

Browse files
vhdagitster
authored andcommitted
git-p4: Allow filtering Perforce branches by user
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 <[email protected]> Acked-by: Pete Wyckoff <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 04d277b commit 8ace74c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

contrib/fast-import/git-p4

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,13 @@ class P4Sync(Command, P4UserMap):
14551455
def getBranchMapping(self):
14561456
lostAndFoundBranches = set()
14571457

1458-
for info in p4CmdList("branches"):
1458+
user = gitConfig("git-p4.branchUser")
1459+
if len(user) > 0:
1460+
command = "branches -u %s" % user
1461+
else:
1462+
command = "branches"
1463+
1464+
for info in p4CmdList(command):
14591465
details = p4Cmd("branch -o %s" % info["branch"])
14601466
viewIdx = 0
14611467
while details.has_key("View%s" % viewIdx):

contrib/fast-import/git-p4.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ Perforce server. Will enable --find-copies-harder git argument.
257257

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

260+
git-p4.branchUser
261+
262+
Only use branch specifications defined by the selected username.
263+
264+
git config [--global] git-p4.branchUser username
265+
260266
Implementation Details...
261267
=========================
262268

0 commit comments

Comments
 (0)