summaryrefslogtreecommitdiff
path: root/contrib/fast-import/p4-fast-export.py
diff options
context:
space:
mode:
authorLibravatar Simon Hausmann <hausmann@kde.org>2007-02-07 23:37:54 +0100
committerLibravatar Simon Hausmann <hausmann@kde.org>2007-02-07 23:37:54 +0100
commit23efd2545b292208740b0f2fb7446d99ce744000 (patch)
tree2d4f72baffc5735b8f8f603f648e15c76a8aeae7 /contrib/fast-import/p4-fast-export.py
parentMake incremental imports easier to use by storing the p4 depot path after an ... (diff)
downloadtgif-23efd2545b292208740b0f2fb7446d99ce744000.tar.xz
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>
Diffstat (limited to 'contrib/fast-import/p4-fast-export.py')
-rwxr-xr-xcontrib/fast-import/p4-fast-export.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/contrib/fast-import/p4-fast-export.py b/contrib/fast-import/p4-fast-export.py
index be4fd36c36..16e3d8d42a 100755
--- a/contrib/fast-import/p4-fast-export.py
+++ b/contrib/fast-import/p4-fast-export.py
@@ -13,7 +13,7 @@ import os, string, sys, time
import marshal, popen2
branch = "refs/heads/p4"
-prefix = os.popen("git-repo-config --get p4.depotpath").read()
+prefix = previousDepotPath = os.popen("git-repo-config --get p4.depotpath").read()
if len(prefix) != 0:
prefix = prefix[:-1]
@@ -22,7 +22,8 @@ if len(sys.argv) == 1 and len(prefix) != 0:
elif len(sys.argv) != 2:
print "usage: %s //depot/path[@revRange]" % sys.argv[0]
print "\n example:"
- print " %s //depot/my/project/ -- to import everything"
+ print " %s //depot/my/project/ -- to import the current head"
+ print " %s //depot/my/project/@all -- to import everything"
print " %s //depot/my/project/@1,6 -- to import only from revision 1 to 6"
print ""
print " (a ... is not needed in the path p4 specification, it's added implicitly)"
@@ -42,7 +43,9 @@ initialParent = ""
if prefix.find("@") != -1:
atIdx = prefix.index("@")
changeRange = prefix[atIdx:]
- if changeRange.find(",") == -1:
+ if changeRange == "@all":
+ changeRange = ""
+ elif changeRange.find(",") == -1:
revision = changeRange
changeRange = ""
prefix = prefix[0:atIdx]
@@ -50,6 +53,8 @@ elif prefix.find("#") != -1:
hashIdx = prefix.index("#")
revision = prefix[hashIdx:]
prefix = prefix[0:hashIdx]
+elif len(previousDepotPath) == 0:
+ revision = "#head"
if prefix.endswith("..."):
prefix = prefix[:-3]