diff options
author | Simon Hausmann <simon@lst.de> | 2007-02-11 18:04:39 +0100 |
---|---|---|
committer | Simon Hausmann <simon@lst.de> | 2007-02-11 18:04:39 +0100 |
commit | fc21f8a1dab090ceb63c479705104cbb95585a2f (patch) | |
tree | 2dbc379cd5e9a16b0341ffdb8f37d1f9e1025779 /contrib | |
parent | Added a little helper script to remove unused tags from the perforce import. (diff) | |
download | tgif-fc21f8a1dab090ceb63c479705104cbb95585a2f.tar.xz |
Create lightweight git tags (using the "reset" trick) for the incremental import instead of full-blown ones. Also fix parsing the output of git name-rev for figuring out the last imported p4 change number.
Signed-off-by: Simon Hausmann <simon@lst.de>
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/fast-import/p4-fast-export.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/contrib/fast-import/p4-fast-export.py b/contrib/fast-import/p4-fast-export.py index 1f19cbc560..989513888a 100755 --- a/contrib/fast-import/p4-fast-export.py +++ b/contrib/fast-import/p4-fast-export.py @@ -170,9 +170,14 @@ if len(changeRange) == 0: try: sout, sin, serr = popen2.popen3("git-name-rev --tags `git-rev-parse %s`" % branch) output = sout.read() + if output.endswith("\n"): + output = output[:-1] tagIdx = output.index(" tags/p4/") - caretIdx = output.index("^") - rev = int(output[tagIdx + 9 : caretIdx]) + 1 + caretIdx = output.find("^") + endPos = len(output) + if caretIdx != -1: + endPos = caretIdx + rev = int(output[tagIdx + 9 : endPos]) + 1 changeRange = "@%s,#head" % rev initialParent = os.popen("git-rev-parse %s" % branch).read()[:-1] initialTag = "p4/%s" % (int(rev) - 1) @@ -247,10 +252,9 @@ else: 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.write("reset refs/tags/p4/%s\n" % lastChange) +gitStream.write("from %s\n\n" % branch); + gitStream.close() gitOutput.close() |