| import os, sys, subprocess |
| from optparse import OptionParser, OptionGroup |
| parser = OptionParser("usage: %prog [options] <repo> <revision>") |
| parser.add_option("", "--branch", dest="branch", |
| help="Ref for the branch to search [%default]", |
| action="store", default="git-svn") |
| (opts, args) = parser.parse_args() |
| parser.error("invalid number of arguments") |
| parser.error("invalid revision argument (not an integer)") |
| p = subprocess.Popen(['git', 'rev-list', opts.branch, '--pretty'], |
| bestRev = bestCommit = None |
| if ln.startswith('commit '): |
| lastCommit = ln.split(' ',2)[1] |
| elif ln.startswith(' git-svn-id: '): |
| _,repo,_ = ln.strip().split(' ') |
| _,lrev = repo.rsplit('@',1) |
| if bestRev is None or lrev>bestRev: |
| if bestCommit is not None: |