@matheusbsbs / matheus-bagliano / commits / 1cd573866a
Fork 0

Make incremental imports easier to use by storing the p4 depot path after an import in .git/config and re-using it when we're invoked again later.

Signed-off-by: Simon Hausmann <hausmann@kde.org>

Simon Hausmann committed Feb 7, 2007 at 23:25 UTC 1cd573866a76d62866b65c458e723983ba58117e
1 file changed +16 -3
contrib/fast-import/p4-fast-export.py
+16 -3
@@ -12,7 +12,14 @@
12 import os, string, sys, time
13 import marshal, popen2
14
15 -if len(sys.argv) != 2:
15 +branch = "refs/heads/p4"
16 +prefix = os.popen("git-repo-config --get p4.depotpath").read()
17 +if len(prefix) != 0:
18 + prefix = prefix[:-1]
19 +
20 +if len(sys.argv) == 1 and len(prefix) != 0:
21 + print "[using previously specified depot path %s]" % prefix
22 +elif len(sys.argv) != 2:
23 print "usage: %s //depot/path[@revRange]" % sys.argv[0]
24 print "\n example:"
25 print " %s //depot/my/project/ -- to import everything"
@@ -21,9 +28,12 @@ if len(sys.argv) != 2:
28 print " (a ... is not needed in the path p4 specification, it's added implicitly)"
29 print ""
30 sys.exit(1)
31 +else:
32 + if len(prefix) != 0 and prefix != sys.argv[1]:
33 + print "previous import used depot path %s and now %s was specified. this doesn't work!" % (prefix, sys.argv[1])
34 + sys.exit(1)
35 + prefix = sys.argv[1]
36
25 -branch = "refs/heads/p4"
26 -prefix = sys.argv[1]
37 changeRange = ""
38 revision = ""
39 users = {}
@@ -222,3 +232,6 @@ else:
232 gitError.close()
233
234 print ""
235 +
236 +os.popen("git-repo-config p4.depotpath %s" % prefix).read()
237 +