Added a little helper script to remove unused tags from the perforce import.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Simon Hausmann committed
Feb 10, 2007 at 10:26 UTC
f7d63b0c99945f4b358df06e4d09837f66db6a88
1 file changed
+40
contrib/fast-import/p4-clean-tags.py
new
+40
@@ -0,0 +1,40 @@
1
+#!/usr/bin/python
2
+#
3
+# p4-debug.py
4
+#
5
+# Author: Simon Hausmann <hausmann@kde.org>
6
+# License: MIT <http://www.opensource.org/licenses/mit-license.php>
7
+#
8
+# removes unused p4 import tags
9
+#
10
+import os, string, sys
11
+import popen2, getopt
12
+
13
+branch = "refs/heads/master"
14
+
15
+try:
16
+ opts, args = getopt.getopt(sys.argv[1:], "", [ "branch=" ])
17
+except getopt.GetoptError:
18
+ print "fixme, syntax error"
19
+ sys.exit(1)
20
+
21
+for o, a in opts:
22
+ if o == "--branch":
23
+ branch = "refs/heads/" + a
24
+
25
+sout, sin, serr = popen2.popen3("git-name-rev --tags `git-rev-parse %s`" % branch)
26
+output = sout.read()
27
+tagIdx = output.index(" tags/p4/")
28
+caretIdx = output.index("^")
29
+rev = int(output[tagIdx + 9 : caretIdx])
30
+
31
+allTags = os.popen("git tag -l p4/").readlines()
32
+for i in range(len(allTags)):
33
+ allTags[i] = int(allTags[i][3:-1])
34
+
35
+allTags.sort()
36
+
37
+allTags.remove(rev)
38
+
39
+for rev in allTags:
40
+ print os.popen("git tag -d p4/%s" % rev).read()