5 # Author: Simon Hausmann <hausmann@kde.org>
6 # License: MIT <http://www.opensource.org/licenses/mit-license.php>
8 # removes unused p4 import tags
10 import os
, string
, sys
13 branch
= "refs/heads/master"
16 opts
, args
= getopt
.getopt(sys
.argv
[1:], "", [ "branch=" ])
17 except getopt
.GetoptError
:
18 print "fixme, syntax error"
23 branch
= "refs/heads/" + a
25 sout
, sin
, serr
= popen2
.popen3("git-name-rev --tags `git-rev-parse %s`" % branch
)
27 tagIdx
= output
.index(" tags/p4/")
29 caretIdx
= output
.index("^")
31 caretIdx
= len(output
) - 1
32 rev
= int(output
[tagIdx
+ 9 : caretIdx
])
34 allTags
= os
.popen("git tag -l p4/").readlines()
35 for i
in range(len(allTags
)):
36 allTags
[i
] = int(allTags
[i
][3:-1])
43 print os
.popen("git tag -d p4/%s" % rev
).read()