summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Simon Hausmann <shausman@trolltech.com>2007-01-31 09:39:20 +0100
committerLibravatar Simon Hausmann <shausman@trolltech.com>2007-01-31 09:39:20 +0100
commitda96cd9e2449295d00cea0e48dc4ca251ab00227 (patch)
treec66a4b62ec083ac7a71063152976b8b02c740037
parentInitial import of a python script to import changesets from Perforce into git. (diff)
downloadtgif-da96cd9e2449295d00cea0e48dc4ca251ab00227.tar.xz
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>
-rw-r--r--contrib/fast-import/p4-fast-export.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/contrib/fast-import/p4-fast-export.py b/contrib/fast-import/p4-fast-export.py
index 238f6e3524..abd6da4668 100644
--- a/contrib/fast-import/p4-fast-export.py
+++ b/contrib/fast-import/p4-fast-export.py
@@ -17,10 +17,22 @@
#
import os, string, sys
-# yep, that's hardcoded right. will fix to a commandline option rsn :)
-prefix = "//depot/qt/main/"
-# that's in revision range syntax, for example @2342,523634
+if len(sys.argv) != 2:
+ sys.stderr.write("usage: %s //depot/path[@revRange]\n" % sys.argv[0]);
+ sys.stderr.write("\n example:\n");
+ sys.stderr.write(" %s //depot/my/project -- to import everything\n");
+ sys.stderr.write(" %s //depot/my/project@1,6 -- to import only from revision 1 to 6\n");
+ sys.stderr.write("\n");
+ sys.exit(1)
+
+prefix = sys.argv[1]
changeRange = ""
+try:
+ atIdx = prefix.index("@")
+ changeRange = prefix[atIdx:]
+ prefix = prefix[0:atIdx]
+except ValueError:
+ changeRange = ""
def describe(change):
output = os.popen("p4 describe %s" % change).readlines()