Use svn_repos_open() for svn-archive.c, too
[fast-export/dharding.git] / p4-clean-tags.py
blob924ff89cc65531540cd49e4e58b9941f2e36cccc
1 #!/usr/bin/python
3 # p4-debug.py
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
11 import popen2, getopt
13 branch = "refs/heads/master"
15 try:
16 opts, args = getopt.getopt(sys.argv[1:], "", [ "branch=" ])
17 except getopt.GetoptError:
18 print "fixme, syntax error"
19 sys.exit(1)
21 for o, a in opts:
22 if o == "--branch":
23 branch = "refs/heads/" + a
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 try:
29 caretIdx = output.index("^")
30 except:
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])
38 allTags.sort()
40 allTags.remove(rev)
42 for rev in allTags:
43 print os.popen("git tag -d p4/%s" % rev).read()