From: Scott Lamb Date: Sun, 03 Jun 2007 03:58:46 GMT Subject: [PATCH 4/4] git-p4import: partial history Message-ID: <11808431401213-git-send-email-slamb@slamb.org> In-Reply-To: <11808431364066-git-send-email-slamb@slamb.org> Allow importing partial history, which is quicker and may be necessary with a low Perforce MaxScanRows limit. Signed-off-by: Scott Lamb --- Documentation/git-p4import.txt | 6 ++++++ git-p4import.py | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Documentation/git-p4import.txt b/Documentation/git-p4import.txt index 714abbe..bf40b5a 100644 --- a/Documentation/git-p4import.txt +++ b/Documentation/git-p4import.txt @@ -10,6 +10,7 @@ SYNOPSIS -------- [verse] `git-p4import` [-q|-v] [--notags] [--authors ] [-t ] + [--start-with ] `git-p4import` --stitch `git-p4import` @@ -59,6 +60,11 @@ OPTIONS etc. You only need to specify this once, it will be saved in the git config file for the repository. +\--start-with:: + Start the import with the given Perforce change. A partial history can + be much faster to generate and is possible even with a low MaxScanRows + limit. + :: The Perforce path that will be imported into the specified branch. diff --git a/git-p4import.py b/git-p4import.py index e7a52b3..c7a2033 100644 --- a/git-p4import.py +++ b/git-p4import.py @@ -33,7 +33,12 @@ def die(msg, *args): sys.exit(1) def usage(): - print "USAGE: git-p4import [-q|-v] [--authors=] [-t ] [//p4repo/path ]" + print "usage:" + print " git-p4import [-q|-v] [--notags] [--authors ] [-t ]" + print " [--start-with ]" + print " " + print " git-p4import --stitch " + print " git-p4import" sys.exit(1) verbosity = 1 @@ -41,6 +46,7 @@ logfile = file("/dev/null", "a") ignore_warnings = False stitch = 0 tagall = True +start_with = 0 def report(level, msg, *args): global verbosity @@ -299,7 +305,8 @@ class git_command: try: opts, args = getopt.getopt(sys.argv[1:], "qhvt:", - ["authors=","help","stitch=","timezone=","log=","ignore","notags"]) + ["authors=","help","stitch=","timezone=","log=","ignore","notags", + "start-with="]) except getopt.GetoptError: usage() @@ -316,6 +323,8 @@ for o, a in opts: usage() if o in ("--ignore"): ignore_warnings = True + if o in ("--start-with"): + start_with = int(a) git = git_command() branch=git.current_branch() @@ -361,6 +370,7 @@ if stitch == 0: top = git.top_change(branch) else: top = 0 +top = max(top, start_with) changes = p4.changes(top) count = len(changes) if count == 0: -- 1.5.2