Make specifying the revision ranges more convenient.
Added support for @all as revision range specifier to import all changes to a given depot path. Also default to an import of #head if no revrange is specified. Signed-off-by: Simon Hausmann <hausmann@kde.org>
Simon Hausmann committed
Feb 7, 2007 at 23:37 UTC
23efd2545b292208740b0f2fb7446d99ce744000
1 file changed
+8
-3
contrib/fast-import/p4-fast-export.py
+8
-3
@@ -13,7 +13,7 @@ import os, string, sys, time
13
import marshal, popen2
14
15
branch = "refs/heads/p4"
16
-prefix = os.popen("git-repo-config --get p4.depotpath").read()
16
+prefix = previousDepotPath = os.popen("git-repo-config --get p4.depotpath").read()
17
if len(prefix) != 0:
18
prefix = prefix[:-1]
19
@@ -22,7 +22,8 @@ if len(sys.argv) == 1 and len(prefix) != 0:
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"
25
+ print " %s //depot/my/project/ -- to import the current head"
26
+ print " %s //depot/my/project/@all -- to import everything"
27
print " %s //depot/my/project/@1,6 -- to import only from revision 1 to 6"
28
print ""
29
print " (a ... is not needed in the path p4 specification, it's added implicitly)"
@@ -42,7 +43,9 @@ initialParent = ""
43
if prefix.find("@") != -1:
44
atIdx = prefix.index("@")
45
changeRange = prefix[atIdx:]
45
- if changeRange.find(",") == -1:
46
+ if changeRange == "@all":
47
+ changeRange = ""
48
+ elif changeRange.find(",") == -1:
49
revision = changeRange
50
changeRange = ""
51
prefix = prefix[0:atIdx]
@@ -50,6 +53,8 @@ elif prefix.find("#") != -1:
53
hashIdx = prefix.index("#")
54
revision = prefix[hashIdx:]
55
prefix = prefix[0:hashIdx]
56
+elif len(previousDepotPath) == 0:
57
+ revision = "#head"
58
59
if prefix.endswith("..."):
60
prefix = prefix[:-3]