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

[PATCH 4/4] git-p4import: partial history

From
SLScott Lamb <slamb@slamb.org>
Date
Jun 3, 2007, 03:58 UTC
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 <slamb@slamb.org>
---
 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
Previous: Scott Lamb
Message 26 of 26 in “git-p4import.py robustness changes”
  1. Scott LambMay 31, 2007
  2. Junio C HamanoMay 31, 2007
  3. Scott LambJun 2, 2007
  4. Junio C HamanoJun 2, 2007
  5. Scott LambJun 2, 2007
  6. Junio C HamanoJun 2, 2007
  7. Simon HausmannJun 3, 2007
  8. Scott LambJun 3, 2007
  9. Shawn O. PearceJun 4, 2007
  10. Dana HowJun 4, 2007
  11. Shawn O. PearceJun 4, 2007
  12. Scott LambJun 4, 2007
  13. Simon HausmannJun 5, 2007
  14. Marius Storm-OlsenJun 4, 2007
  15. Shawn O. PearceJun 4, 2007
  16. Simon HausmannJun 12, 2007
  17. Scott LambJun 13, 2007
  18. Simon HausmannJun 13, 2007
  19. Shawn O. PearceJun 14, 2007
  20. Simon HausmannJun 14, 2007
  21. Shawn O. PearceJun 15, 2007
  22. Marius Storm-OlsenJun 15, 2007
  23. 1/4 git-p4import: fix subcommand error handlingScott Lamb, Jun 3, 2007
  24. 2/4 git-p4import: use lists of subcommand argumentsScott Lamb, Jun 3, 2007
  25. 3/4 git-p4import: resume on correct p4 changesetScott Lamb, Jun 3, 2007
  26. 4/4 git-p4import: partial historyScott Lamb, Jun 3, 2007

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.