Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(197)

Side by Side Diff: static/upload.py

Issue 955: Allow upload with no base (Closed) SVN Base: http://rietveld.googlecode.com/svn/trunk/
Patch Set: Created 4 months, 4 weeks ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2007 Google Inc. 3 # Copyright 2007 Google Inc.
4 # 4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License. 6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at 7 # You may obtain a copy of the License at
8 # 8 #
9 # http://www.apache.org/licenses/LICENSE-2.0 9 # http://www.apache.org/licenses/LICENSE-2.0
10 # 10 #
(...skipping 343 matching lines...) Show 10 above Show 10 below
354 parser.add_option("--no_cookies", action="store_false", 354 parser.add_option("--no_cookies", action="store_false",
355 dest="save_cookies", default=True, 355 dest="save_cookies", default=True,
356 help="Do not save authentication cookies to local disk.") 356 help="Do not save authentication cookies to local disk.")
357 parser.add_option("-m", "--message", action="store", dest="message", 357 parser.add_option("-m", "--message", action="store", dest="message",
358 metavar="MESSAGE", default=None, 358 metavar="MESSAGE", default=None,
359 help="A message to identify the patch. " 359 help="A message to identify the patch. "
360 "Will prompt if omitted.") 360 "Will prompt if omitted.")
361 parser.add_option("-i", "--issue", type="int", action="store", 361 parser.add_option("-i", "--issue", type="int", action="store",
362 metavar="ISSUE", default=None, 362 metavar="ISSUE", default=None,
363 help="Issue number to which to add. Defaults to new issue.") 363 help="Issue number to which to add. Defaults to new issue.")
364 parser.add_option("--lb", action="store_true",
GvR 2008/05/17 03:29:02 I recommend "-l", "--local_base"
365 dest="local_base", default=False,
366 help="base file will be uploaded")
364 367
365 368
366 def GetRpcServer(options): 369 def GetRpcServer(options):
367 """Returns an instance of an AbstractRpcServer. 370 """Returns an instance of an AbstractRpcServer.
368 371
369 Returns: 372 Returns:
370 A new AbstractRpcServer, on which RPC calls can be made. 373 A new AbstractRpcServer, on which RPC calls can be made.
371 """ 374 """
372 375
373 rpc_server_class = HttpRpcServer 376 rpc_server_class = HttpRpcServer
(...skipping 114 matching lines...) Show 10 above Show 10 below
488 def RealMain(argv): 491 def RealMain(argv):
489 logging.basicConfig(format=("%(asctime).19s %(levelname)s %(filename)s:" 492 logging.basicConfig(format=("%(asctime).19s %(levelname)s %(filename)s:"
490 "%(lineno)s %(message)s ")) 493 "%(lineno)s %(message)s "))
491 options, args = parser.parse_args(sys.argv[1:]) 494 options, args = parser.parse_args(sys.argv[1:])
492 global verbosity 495 global verbosity
493 verbosity = options.verbose 496 verbosity = options.verbose
494 if verbosity >= 3: 497 if verbosity >= 3:
495 logging.getLogger().setLevel(logging.DEBUG) 498 logging.getLogger().setLevel(logging.DEBUG)
496 elif verbosity >= 2: 499 elif verbosity >= 2:
497 logging.getLogger().setLevel(logging.INFO) 500 logging.getLogger().setLevel(logging.INFO)
498 base = GuessBase() 501 if options.local_base:
502 base = "None"
GvR 2008/05/17 03:29:02 I'd set it to the empty string. That should be tur
503 else:
504 base = GuessBase()
499 CheckForUnknownFiles() 505 CheckForUnknownFiles()
500 data = RunShell("svn diff", args) 506 data = RunShell("svn diff", args)
501 count = 0 507 count = 0
502 for line in data.splitlines(): 508 for line in data.splitlines():
503 if line.startswith("Index:"): 509 if line.startswith("Index:"):
504 count += 1 510 count += 1
505 logging.info(line) 511 logging.info(line)
506 if not count: 512 if not count:
507 ErrorExit("No valid patches found in output from svn diff") 513 ErrorExit("No valid patches found in output from svn diff")
508 if options.issue: 514 if options.issue:
(...skipping 34 matching lines...) Show 10 above Show 10 below
543 try: 549 try:
544 RealMain(sys.argv) 550 RealMain(sys.argv)
545 except KeyboardInterrupt: 551 except KeyboardInterrupt:
546 print 552 print
547 StatusUpdate("Interrupted.") 553 StatusUpdate("Interrupted.")
548 sys.exit(1) 554 sys.exit(1)
549 555
550 556
551 if __name__ == "__main__": 557 if __name__ == "__main__":
552 main() 558 main()
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r338