Chromium Code Reviews

Side by Side Diff: drover.py

Issue 330008: Change the default workdir for drover. (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/tools/depot_tools/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 325 matching lines...)
336 answer = None 336 answer = None
337 337
338 def text_prompt(question, default): 338 def text_prompt(question, default):
339 print question + " [" + default + "]:" 339 print question + " [" + default + "]:"
340 answer = sys.stdin.readline() 340 answer = sys.stdin.readline()
341 if answer.strip() == "": 341 if answer.strip() == "":
342 return default 342 return default
343 return answer 343 return answer
344 344
345 def main(options, args): 345 def main(options, args):
346 revision = options.revert or options.merge
347
348 # Initialize some variables used below. They can be overwritten by
349 # the drover.properties file.
346 BASE_URL = "svn://chrome-svn/chrome" 350 BASE_URL = "svn://chrome-svn/chrome"
347 TRUNK_URL = BASE_URL + "/trunk/src" 351 TRUNK_URL = BASE_URL + "/trunk/src"
348 BRANCH_URL = BASE_URL + "/branches/$branch/src" 352 BRANCH_URL = BASE_URL + "/branches/$branch/src"
349 DEFAULT_WORKING = "working"
350 SKIP_CHECK_WORKING = True 353 SKIP_CHECK_WORKING = True
351 PROMPT_FOR_AUTHOR = False 354 PROMPT_FOR_AUTHOR = False
352 355
356 DEFAULT_WORKING = "drover_" + str(revision)
357 if options.branch:
358 DEFAULT_WORKING += ("_" + options.branch)
359
353 # Override the default properties if there is a drover.properties file. 360 # Override the default properties if there is a drover.properties file.
354 global file_pattern_ 361 global file_pattern_
355 if os.path.exists("drover.properties"): 362 if os.path.exists("drover.properties"):
356 file = open("drover.properties") 363 file = open("drover.properties")
357 exec(file) 364 exec(file)
358 file.close() 365 file.close()
359 if FILE_PATTERN: 366 if FILE_PATTERN:
360 file_pattern_ = FILE_PATTERN 367 file_pattern_ = FILE_PATTERN
361 368
362 revision = options.revert or options.merge
363
364 if options.revert and options.branch: 369 if options.revert and options.branch:
365 url = BRANCH_URL.replace("$branch", options.branch) 370 url = BRANCH_URL.replace("$branch", options.branch)
366 else: 371 else:
367 url = TRUNK_URL 372 url = TRUNK_URL
368 373
369 working = options.workdir or DEFAULT_WORKING 374 working = options.workdir or DEFAULT_WORKING
370 375
371 command = 'svn log ' + url + " -r "+str(revision) + " -v" 376 command = 'svn log ' + url + " -r "+str(revision) + " -v"
372 os.system(command) 377 os.system(command)
373 378
(...skipping 92 matching lines...)
466 471
467 if not options.merge and not options.revert: 472 if not options.merge and not options.revert:
468 option_parser.error("You need at least --merge or --revert") 473 option_parser.error("You need at least --merge or --revert")
469 sys.exit(1) 474 sys.exit(1)
470 475
471 if options.merge and not options.branch: 476 if options.merge and not options.branch:
472 option_parser.error("--merge requires a --branch") 477 option_parser.error("--merge requires a --branch")
473 sys.exit(1) 478 sys.exit(1)
474 479
475 sys.exit(main(options, args)) 480 sys.exit(main(options, args))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine