summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Simon Hausmann <shausman@trolltech.com>2007-02-10 10:26:03 +0100
committerLibravatar Simon Hausmann <shausman@trolltech.com>2007-02-10 10:26:03 +0100
commitf7d63b0c99945f4b358df06e4d09837f66db6a88 (patch)
tree53e9cf22071f44920b1ab950056a696fc56b004d
parentChanged the default git import branch from "p4" to "master". (diff)
downloadtgif-f7d63b0c99945f4b358df06e4d09837f66db6a88.tar.xz
Added a little helper script to remove unused tags from the perforce import.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
-rwxr-xr-xcontrib/fast-import/p4-clean-tags.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/fast-import/p4-clean-tags.py b/contrib/fast-import/p4-clean-tags.py
new file mode 100755
index 0000000000..0be51f6405
--- /dev/null
+++ b/contrib/fast-import/p4-clean-tags.py
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+#
+# p4-debug.py
+#
+# Author: Simon Hausmann <hausmann@kde.org>
+# License: MIT <http://www.opensource.org/licenses/mit-license.php>
+#
+# removes unused p4 import tags
+#
+import os, string, sys
+import popen2, getopt
+
+branch = "refs/heads/master"
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "", [ "branch=" ])
+except getopt.GetoptError:
+ print "fixme, syntax error"
+ sys.exit(1)
+
+for o, a in opts:
+ if o == "--branch":
+ branch = "refs/heads/" + a
+
+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("^")
+rev = int(output[tagIdx + 9 : caretIdx])
+
+allTags = os.popen("git tag -l p4/").readlines()
+for i in range(len(allTags)):
+ allTags[i] = int(allTags[i][3:-1])
+
+allTags.sort()
+
+allTags.remove(rev)
+
+for rev in allTags:
+ print os.popen("git tag -d p4/%s" % rev).read()