OLD | NEW |
---|---|
1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import optparse | 5 import optparse |
6 import os | 6 import os |
7 import re | 7 import re |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 import webbrowser | 10 import webbrowser |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 if FILE_PATTERN: | 359 if FILE_PATTERN: |
360 file_pattern_ = FILE_PATTERN | 360 file_pattern_ = FILE_PATTERN |
361 | 361 |
362 revision = options.revert or options.merge | 362 revision = options.revert or options.merge |
363 | 363 |
364 if options.revert and options.branch: | 364 if options.revert and options.branch: |
365 url = BRANCH_URL.replace("$branch", options.branch) | 365 url = BRANCH_URL.replace("$branch", options.branch) |
366 else: | 366 else: |
367 url = TRUNK_URL | 367 url = TRUNK_URL |
368 | 368 |
369 working = DEFAULT_WORKING | 369 working = options.workdir or DEFAULT_WORKING |
M-A Ruel
2009/10/23 19:45:50
2 whitespaces.
| |
370 | 370 |
371 command = 'svn log ' + url + " -r "+str(revision) + " -v" | 371 command = 'svn log ' + url + " -r "+str(revision) + " -v" |
372 os.system(command) | 372 os.system(command) |
373 | 373 |
374 if not (options.revertbot or prompt("Is this the correct revision?")): | 374 if not (options.revertbot or prompt("Is this the correct revision?")): |
375 sys.exit(0) | 375 sys.exit(0) |
376 | 376 |
377 if (os.path.exists(working)): | 377 if (os.path.exists(working)): |
378 if not (options.revertbot or SKIP_CHECK_WORKING or | 378 if not (options.revertbot or SKIP_CHECK_WORKING or |
379 prompt("Working directory: '%s' already exists, clobber?" % working)): | 379 prompt("Working directory: '%s' already exists, clobber?" % working)): |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 sys.exit(0) | 448 sys.exit(0) |
449 | 449 |
450 if __name__ == "__main__": | 450 if __name__ == "__main__": |
451 option_parser = optparse.OptionParser(usage=USAGE % {"app": sys.argv[0]}) | 451 option_parser = optparse.OptionParser(usage=USAGE % {"app": sys.argv[0]}) |
452 option_parser.add_option('-m', '--merge', type="int", | 452 option_parser.add_option('-m', '--merge', type="int", |
453 help='Revision to merge from trunk to branch') | 453 help='Revision to merge from trunk to branch') |
454 option_parser.add_option('-b', '--branch', | 454 option_parser.add_option('-b', '--branch', |
455 help='Branch to revert or merge from') | 455 help='Branch to revert or merge from') |
456 option_parser.add_option('-r', '--revert', type="int", | 456 option_parser.add_option('-r', '--revert', type="int", |
457 help='Revision to revert') | 457 help='Revision to revert') |
458 option_parser.add_option('-w', '--workdir', | |
459 help='subdir to use for the revert') | |
458 option_parser.add_option('', '--revertbot', action='store_true', | 460 option_parser.add_option('', '--revertbot', action='store_true', |
459 default=False) | 461 default=False) |
460 option_parser.add_option('', '--revertbot-commit', action='store_true', | 462 option_parser.add_option('', '--revertbot-commit', action='store_true', |
461 default=False) | 463 default=False) |
462 option_parser.add_option('', '--revertbot-reviewers') | 464 option_parser.add_option('', '--revertbot-reviewers') |
463 options, args = option_parser.parse_args() | 465 options, args = option_parser.parse_args() |
464 | 466 |
465 if not options.merge and not options.revert: | 467 if not options.merge and not options.revert: |
466 option_parser.error("You need at least --merge or --revert") | 468 option_parser.error("You need at least --merge or --revert") |
467 sys.exit(1) | 469 sys.exit(1) |
468 | 470 |
469 if options.merge and not options.branch: | 471 if options.merge and not options.branch: |
470 option_parser.error("--merge requires a --branch") | 472 option_parser.error("--merge requires a --branch") |
471 sys.exit(1) | 473 sys.exit(1) |
472 | 474 |
473 sys.exit(main(options, args)) | 475 sys.exit(main(options, args)) |
OLD | NEW |