git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 2/4] git-p4: Allow filtering Perforce branches by user

From
Vitor Antunes <vitor.hda@gmail.com>
Date
Aug 28, 2011, 21:58 UTC
Message-ID
<1314568710-6472-3-git-send-email-vitor.hda@gmail.com>
In-Reply-To
<1314568710-6472-1-git-send-email-vitor.hda@gmail.com>

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>
---
 contrib/fast-import/git-p4     |    8 +++++++-
 contrib/fast-import/git-p4.txt |    6 ++++++
 2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 72a5b6c..6314c20 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -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):
diff --git a/contrib/fast-import/git-p4.txt b/contrib/fast-import/git-p4.txt
index 2ffbccc..97b66b9 100644
--- a/contrib/fast-import/git-p4.txt
+++ b/contrib/fast-import/git-p4.txt
@@ -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...
 =========================
 
-- 
1.7.5.4
Previous: Vitor AntunesNext: Vitor Antunes
Message 3 of 7 in “git-p4: Improve branch support”
  1. 0/4 git-p4: Improve branch supportVitor Antunes, Aug 28, 2011
  2. 1/4 git-p4: Correct branch base depot path detectionVitor Antunes, Aug 28, 2011
  3. 2/4 git-p4: Allow filtering Perforce branches by userVitor Antunes, Aug 28, 2011
  4. 3/4 git-p4: Allow branch definition with git configVitor Antunes, Aug 28, 2011
  5. 4/4 git-p4: Add simple test case for branch importVitor Antunes, Aug 28, 2011
  6. Junio C HamanoAug 29, 2011
  7. Vitor AntunesAug 29, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.