@matheusbsbs / matheus-bagliano / commits / da96cd9e24
Fork 0

Added basic support for specifying the depot path to import from as well as the range of perforce changes.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>

Simon Hausmann committed Jan 31, 2007 at 09:39 UTC da96cd9e2449295d00cea0e48dc4ca251ab00227
1 file changed +15 -3
contrib/fast-import/p4-fast-export.py
+15 -3
@@ -17,10 +17,22 @@
17 #
18 import os, string, sys
19
20 -# yep, that's hardcoded right. will fix to a commandline option rsn :)
21 -prefix = "//depot/qt/main/"
22 -# that's in revision range syntax, for example @2342,523634
20 +if len(sys.argv) != 2:
21 + sys.stderr.write("usage: %s //depot/path[@revRange]\n" % sys.argv[0]);
22 + sys.stderr.write("\n example:\n");
23 + sys.stderr.write(" %s //depot/my/project -- to import everything\n");
24 + sys.stderr.write(" %s //depot/my/project@1,6 -- to import only from revision 1 to 6\n");
25 + sys.stderr.write("\n");
26 + sys.exit(1)
27 +
28 +prefix = sys.argv[1]
29 changeRange = ""
30 +try:
31 + atIdx = prefix.index("@")
32 + changeRange = prefix[atIdx:]
33 + prefix = prefix[0:atIdx]
34 +except ValueError:
35 + changeRange = ""
36
37 def describe(change):
38 output = os.popen("p4 describe %s" % change).readlines()