[PATCH RFC] git-p4: Support usage of perforce client spec

Previous thread: BUG: rebase -p after cherry-pick does not work by sf on Monday, February 18, 2008 - 7:06 am. (2 messages)

Next thread: none
From: Tor Arvid Lund
Date: Monday, February 18, 2008 - 7:22 am

When syncing, git-p4 will only download files that are included in the active
perforce client spec. This does not change the default behaviour - it requires
that the user either supplies the command line argument --use-client-spec, or
sets the git config option p4.useclientspec to "true".

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
---

This is something I use personally to help reduce the size downloaded when
cloning and syncing, as the Perforce depot i normally use is littered with
changelists that are much bigger than they should (and thus contain both
interesting and uninteresting files). I thought it might be of use to other
people too.

Note that this is my first attempt at git-related hacking (and that I am also a
Python novice), so it may very well need some tuning/fixing before it is any
good.

 contrib/fast-import/git-p4 |   50 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 781a0cb..e3766c3 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -817,7 +817,9 @@ class P4Sync(Command):
                                      help="Import into refs/heads/ , not refs/remotes"),
                 optparse.make_option("--max-changes", dest="maxChanges"),
                 optparse.make_option("--keep-path", dest="keepRepoPath", action='store_true',
-                                     help="Keep entire BRANCH/DIR/SUBDIR prefix during import")
+                                     help="Keep entire BRANCH/DIR/SUBDIR prefix during import"),
+                optparse.make_option("--use-client-spec", dest="useClientSpec", action='store_true',
+                                     help="Only sync files that are included in the Perforce Client Spec")
         ]
         self.description = """Imports from Perforce into a git repository.\n
     example:
@@ -843,6 +845,8 @@ class P4Sync(Command):
         self.keepRepoPath = ...
Previous thread: BUG: rebase -p after cherry-pick does not work by sf on Monday, February 18, 2008 - 7:06 am. (2 messages)

Next thread: none