Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Avoid the excessive use of git tags for every perforce change and instead just create one git tag for the last imported change.
author
Simon Hausmann
<simon@lst.de>
Sat, 10 Feb 2007 09:05:29 +0000
(10:05 +0100)
committer
Simon Hausmann
<simon@lst.de>
Sat, 10 Feb 2007 09:05:29 +0000
(10:05 +0100)
Signed-off-by: Simon Hausmann <simon@lst.de>
contrib/fast-import/p4-fast-export.py
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
b41507a
)
diff --git
a/contrib/fast-import/p4-fast-export.py
b/contrib/fast-import/p4-fast-export.py
index d1faa7c29040407fd80a8724f5c1e565ca00d24b..907a56dc8a4749dc5dc9f9b39149fb7a24721c4e 100755
(executable)
--- a/
contrib/fast-import/p4-fast-export.py
+++ b/
contrib/fast-import/p4-fast-export.py
@@
-49,6
+49,9
@@
revision = ""
users = {}
initialParent = ""
revision = ""
users = {}
initialParent = ""
+lastChange = ""
+lastCommitter = ""
+initialTag = ""
if prefix.find("@") != -1:
atIdx = prefix.index("@")
if prefix.find("@") != -1:
atIdx = prefix.index("@")
@@
-94,6
+97,8
@@
def p4Cmd(cmd):
def commit(details):
global initialParent
global users
def commit(details):
global initialParent
global users
+ global lastChange
+ global lastCommitter
epoch = details["time"]
author = details["user"]
epoch = details["time"]
author = details["user"]
@@
-147,11
+152,8
@@
def commit(details):
gitStream.write("\n")
gitStream.write("\n")
- gitStream.write("tag p4/%s\n" % details["change"])
- gitStream.write("from %s\n" % branch);
- gitStream.write("tagger %s\n" % committer);
- gitStream.write("data 0\n\n")
-
+ lastChange = details["change"]
+ lastCommitter = committer
def getUserMap():
users = {}
def getUserMap():
users = {}
@@
-173,6
+175,7
@@
def getUserMap():
rev = int(output[tagIdx + 9 : caretIdx]) + 1
changeRange = "@%s,#head" % rev
initialParent = os.popen("git-rev-parse %s" % branch).read()[:-1]
rev = int(output[tagIdx + 9 : caretIdx]) + 1
changeRange = "@%s,#head" % rev
initialParent = os.popen("git-rev-parse %s" % branch).read()[:-1]
+ initialTag = "p4/%s" % (int(rev) - 1)
except:
pass
except:
pass
@@
-244,10
+247,17
@@
def getUserMap():
print ""
print ""
+gitStream.write("tag p4/%s\n" % lastChange)
+gitStream.write("from %s\n" % branch);
+gitStream.write("tagger %s\n" % lastCommitter);
+gitStream.write("data 0\n\n")
+
gitStream.close()
gitOutput.close()
gitError.close()
os.popen("git-repo-config p4.depotpath %s" % prefix).read()
gitStream.close()
gitOutput.close()
gitError.close()
os.popen("git-repo-config p4.depotpath %s" % prefix).read()
+if len(initialTag) > 0:
+ os.popen("git tag -d %s" % initialTag).read()
sys.exit(0)
sys.exit(0)