| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 import getpass | 3 import getpass |
| 4 import optparse | 4 import optparse |
| 5 import os | 5 import os |
| 6 import subprocess | 6 import subprocess |
| 7 import tempfile | 7 import tempfile |
| 8 import traceback | 8 import traceback |
| 9 import urllib | 9 import urllib |
| 10 import sys | 10 import sys |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 branch = branch[len('refs/heads/'):] | 42 branch = branch[len('refs/heads/'):] |
| 43 return branch | 43 return branch |
| 44 | 44 |
| 45 | 45 |
| 46 def GetPatchName(): | 46 def GetPatchName(): |
| 47 """Construct a name for this patch.""" | 47 """Construct a name for this patch.""" |
| 48 short_sha = Backquote(['git', 'rev-parse', '--short=4', 'HEAD']) | 48 short_sha = Backquote(['git', 'rev-parse', '--short=4', 'HEAD']) |
| 49 return GetBranchName() + '-' + short_sha | 49 return GetBranchName() + '-' + short_sha |
| 50 | 50 |
| 51 | 51 |
| 52 def GetRevision(): | |
| 53 """Get the latest Subversion revision number.""" | |
| 54 for line in Backquote(['git', 'svn', 'info']).split('\n'): | |
| 55 if line.startswith('Revision:'): | |
| 56 return line[len('Revision:'):].strip() | |
| 57 raise "Couldn't figure out latest revision" | |
| 58 | |
| 59 | |
| 60 def GetRietveldIssueNumber(): | 52 def GetRietveldIssueNumber(): |
| 61 return Backquote(['git', 'config', | 53 return Backquote(['git', 'config', |
| 62 'branch.%s.rietveldissue' % GetBranchName()]) | 54 'branch.%s.rietveldissue' % GetBranchName()]) |
| 63 | 55 |
| 64 | 56 |
| 65 def GetRietveldPatchsetNumber(): | 57 def GetRietveldPatchsetNumber(): |
| 66 return Backquote(['git', 'config', | 58 return Backquote(['git', 'config', |
| 67 'branch.%s.rietveldpatchset' % GetBranchName()]) | 59 'branch.%s.rietveldpatchset' % GetBranchName()]) |
| 68 | 60 |
| 69 | 61 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 '--use_svn', '--svn_repo', | 158 '--use_svn', '--svn_repo', |
| 167 'svn://svn.chromium.org/chrome-try/try', | 159 'svn://svn.chromium.org/chrome-try/try', |
| 168 ]) | 160 ]) |
| 169 | 161 |
| 170 if options.bot: | 162 if options.bot: |
| 171 args.extend(['--bot', options.bot]) | 163 args.extend(['--bot', options.bot]) |
| 172 if options.clobber: | 164 if options.clobber: |
| 173 args.append('--clobber') | 165 args.append('--clobber') |
| 174 if options.revision: | 166 if options.revision: |
| 175 args.extend(['-r', options.revision]) | 167 args.extend(['-r', options.revision]) |
| 176 else: | |
| 177 args.extend(['-r', GetRevision()]) | |
| 178 if GetRietveldPatchsetNumber(): | 168 if GetRietveldPatchsetNumber(): |
| 179 args.extend([ | 169 args.extend([ |
| 180 '--issue', GetRietveldIssueNumber(), | 170 '--issue', GetRietveldIssueNumber(), |
| 181 '--patchset', GetRietveldPatchsetNumber(), | 171 '--patchset', GetRietveldPatchsetNumber(), |
| 182 ]) | 172 ]) |
| 183 | 173 |
| 184 print sendmsg | 174 print sendmsg |
| 185 TryChange(args=args) | 175 TryChange(args=args) |
| OLD | NEW |