Allow importing partial history, which is quicker and may be necessary with a low Perforce MaxScanRows limit. Signed-off-by: Scott Lamb <slamb@xxxxxxxxx> --- 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 <file>] [-t <timezone>] + [--start-with <change>] <//p4repo/path> <branch> `git-p4import` --stitch <//p4repo/path> `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. + <//p4repo/path>:: 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=<file>] [-t <timezone>] [//p4repo/path <branch>]" + print "usage:" + print " git-p4import [-q|-v] [--notags] [--authors <file>] [-t <timezone>]" + print " [--start-with <change>]" + print " <//p4repo/path> <branch>" + print " git-p4import --stitch <//p4repo/path>" + 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 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html