summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Simon Hausmann <hausmann@kde.org>2007-02-01 08:23:39 +0100
committerLibravatar Simon Hausmann <hausmann@kde.org>2007-02-01 08:23:39 +0100
commitf16255f559c96b8c5fb096b00c94a69f5fcc498f (patch)
treeb650bf9af8b31eb9501fa68447ef25ccf93c8635
parentStarted working on incremental imports from Perforce. (diff)
downloadtgif-f16255f559c96b8c5fb096b00c94a69f5fcc498f.tar.xz
Simplify the incremental import by elimination the need for a temporary import branch.
It turns out that git fast-import can "resume" from an existing branch just fine. Signed-off-by: Simon Hausmann <hausmann@kde.org>
-rwxr-xr-xcontrib/fast-import/p4-fast-export.py21
1 files changed, 3 insertions, 18 deletions
diff --git a/contrib/fast-import/p4-fast-export.py b/contrib/fast-import/p4-fast-export.py
index da3eb35841..c5b15206b1 100755
--- a/contrib/fast-import/p4-fast-export.py
+++ b/contrib/fast-import/p4-fast-export.py
@@ -7,11 +7,7 @@
#
# TODO:
# - support integrations (at least p4i)
-# - support incremental imports
-# - create tags
-# - instead of reading all files into a variable try to pipe from
# - support p4 submit (hah!)
-# - don't hardcode the import to master
#
import os, string, sys, time
import marshal, popen2
@@ -26,8 +22,7 @@ if len(sys.argv) != 2:
print ""
sys.exit(1)
-master = "refs/heads/p4"
-branch = "refs/heads/p4-import"
+branch = "refs/heads/p4"
prefix = sys.argv[1]
changeRange = ""
try:
@@ -74,24 +69,18 @@ def getUserMap():
users = getUserMap()
topMerge = ""
-incremental = 0
-# try incremental import
if len(changeRange) == 0:
try:
- sout, sin, serr = popen2.popen3("git-name-rev --tags `git-rev-parse %s`" % master)
+ sout, sin, serr = popen2.popen3("git-name-rev --tags `git-rev-parse %s`" % branch)
output = sout.read()
tagIdx = output.index(" tags/p4/")
caretIdx = output.index("^")
revision = int(output[tagIdx + 9 : caretIdx]) + 1
changeRange = "@%s,#head" % revision
- topMerge = os.popen("git-rev-parse %s" % master).read()[:-1]
- incremental = 1
+ topMerge = os.popen("git-rev-parse %s" % branch).read()[:-1]
except:
pass
-if incremental == 0:
- branch = master
-
output = os.popen("p4 changes %s...%s" % (prefix, changeRange)).readlines()
changes = []
@@ -181,8 +170,4 @@ gitStream.close()
gitOutput.close()
gitError.close()
-if incremental == 1:
- os.popen("git rebase p4-import p4")
- os.popen("git branch -d p4-import")
-
print ""