3 import os
, sys
, subprocess
6 from optparse
import OptionParser
, OptionGroup
7 parser
= OptionParser("usage: %prog [options] <repo> <revision>")
8 parser
.add_option("", "--dump-section-data", dest
="dumpSectionData",
9 help="Dump the contents of sections",
10 action
="store_true", default
=False)
11 (opts
, args
) = parser
.parse_args()
14 parser
.error("invalid number of arguments")
21 parser
.error("invalid revision argument (not an integer)")
24 p
= subprocess
.Popen(['git', 'rev-list', 'git-svn', '--pretty'],
25 stdout
=subprocess
.PIPE
)
27 bestRev
= bestCommit
= None
30 if ln
.startswith('commit '):
31 lastCommit
= ln
.split(' ',2)[1]
32 elif ln
.startswith(' git-svn-id: '):
33 _
,repo
,_
= ln
.strip().split(' ')
34 _
,lrev
= repo
.rsplit('@',1)
37 if bestRev
is None or lrev
>bestRev
:
39 bestCommit
= lastCommit
44 if bestCommit
is not None:
49 if __name__
=='__main__':