Avoid the excessive use of git tags for every perforce change and instead just create one git tag for the last imported change.
Signed-off-by: Simon Hausmann <simon@lst.de>
This commit is contained in:
parent
b41507a427
commit
8718f3ec9a
@ -49,6 +49,9 @@ changeRange = ""
|
|||||||
revision = ""
|
revision = ""
|
||||||
users = {}
|
users = {}
|
||||||
initialParent = ""
|
initialParent = ""
|
||||||
|
lastChange = ""
|
||||||
|
lastCommitter = ""
|
||||||
|
initialTag = ""
|
||||||
|
|
||||||
if prefix.find("@") != -1:
|
if prefix.find("@") != -1:
|
||||||
atIdx = prefix.index("@")
|
atIdx = prefix.index("@")
|
||||||
@ -94,6 +97,8 @@ def p4Cmd(cmd):
|
|||||||
def commit(details):
|
def commit(details):
|
||||||
global initialParent
|
global initialParent
|
||||||
global users
|
global users
|
||||||
|
global lastChange
|
||||||
|
global lastCommitter
|
||||||
|
|
||||||
epoch = details["time"]
|
epoch = details["time"]
|
||||||
author = details["user"]
|
author = details["user"]
|
||||||
@ -147,11 +152,8 @@ def commit(details):
|
|||||||
|
|
||||||
gitStream.write("\n")
|
gitStream.write("\n")
|
||||||
|
|
||||||
gitStream.write("tag p4/%s\n" % details["change"])
|
lastChange = details["change"]
|
||||||
gitStream.write("from %s\n" % branch);
|
lastCommitter = committer
|
||||||
gitStream.write("tagger %s\n" % committer);
|
|
||||||
gitStream.write("data 0\n\n")
|
|
||||||
|
|
||||||
|
|
||||||
def getUserMap():
|
def getUserMap():
|
||||||
users = {}
|
users = {}
|
||||||
@ -173,6 +175,7 @@ if len(changeRange) == 0:
|
|||||||
rev = int(output[tagIdx + 9 : caretIdx]) + 1
|
rev = int(output[tagIdx + 9 : caretIdx]) + 1
|
||||||
changeRange = "@%s,#head" % rev
|
changeRange = "@%s,#head" % rev
|
||||||
initialParent = os.popen("git-rev-parse %s" % branch).read()[:-1]
|
initialParent = os.popen("git-rev-parse %s" % branch).read()[:-1]
|
||||||
|
initialTag = "p4/%s" % (int(rev) - 1)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -244,10 +247,17 @@ else:
|
|||||||
|
|
||||||
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()
|
gitStream.close()
|
||||||
gitOutput.close()
|
gitOutput.close()
|
||||||
gitError.close()
|
gitError.close()
|
||||||
|
|
||||||
os.popen("git-repo-config p4.depotpath %s" % prefix).read()
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user