Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: trychange.py

Issue 5680006: Add support for an --upstream_branch argument to make diffing against... (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« 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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Client-side script to send a try job to the try server. It communicates to 6 """Client-side script to send a try job to the try server. It communicates to
7 the try server by either writting to a svn repository or by directly connecting 7 the try server by either writting to a svn repository or by directly connecting
8 to the server by HTTP. 8 to the server by HTTP.
9 """ 9 """
10 10
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 "@branch to specify the " 567 "@branch to specify the "
568 "revision/branch to diff against. If no @branch is " 568 "revision/branch to diff against. If no @branch is "
569 "given the diff will be against the upstream branch. " 569 "given the diff will be against the upstream branch. "
570 "If @branch then the diff is branch..HEAD. " 570 "If @branch then the diff is branch..HEAD. "
571 "All edits must be checked in.") 571 "All edits must be checked in.")
572 group.add_option("--no_gclient", action="store_true", 572 group.add_option("--no_gclient", action="store_true",
573 help="Disable automatic search for gclient checkout.") 573 help="Disable automatic search for gclient checkout.")
574 group.add_option("-E", "--exclude", action="append", 574 group.add_option("-E", "--exclude", action="append",
575 default=['ChangeLog'], metavar='REGEXP', 575 default=['ChangeLog'], metavar='REGEXP',
576 help="Regexp patterns to exclude files. Default: %default") 576 help="Regexp patterns to exclude files. Default: %default")
577 group.add_option("--upstream_branch", action="store",
578 help="specify the upstream branch to diff against in the "
579 "main checkout")
M-A Ruel 2010/12/15 20:01:21 can you align with the = ?
577 parser.add_option_group(group) 580 parser.add_option_group(group)
578 581
579 group = optparse.OptionGroup(parser, "Access the try server by HTTP") 582 group = optparse.OptionGroup(parser, "Access the try server by HTTP")
580 group.add_option("--use_http", 583 group.add_option("--use_http",
581 action="store_const", 584 action="store_const",
582 const=_SendChangeHTTP, 585 const=_SendChangeHTTP,
583 dest="send_patch", 586 dest="send_patch",
584 help="Use HTTP to talk to the try server [default]") 587 help="Use HTTP to talk to the try server [default]")
585 group.add_option("-H", "--host", 588 group.add_option("-H", "--host",
586 help="Host address") 589 help="Host address")
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 match = re.match(r'^(.*)/(\d+)$', options.rietveld_url) 647 match = re.match(r'^(.*)/(\d+)$', options.rietveld_url)
645 if match: 648 if match:
646 if options.issue or options.patchset: 649 if options.issue or options.patchset:
647 parser.error('Cannot use both --issue and use a review number url') 650 parser.error('Cannot use both --issue and use a review number url')
648 options.issue = int(match.group(2)) 651 options.issue = int(match.group(2))
649 options.rietveld_url = match.group(1) 652 options.rietveld_url = match.group(1)
650 653
651 try: 654 try:
652 # Always include os.getcwd() in the checkout settings. 655 # Always include os.getcwd() in the checkout settings.
653 checkouts = [] 656 checkouts = []
654 checkouts.append(GuessVCS(options, os.getcwd())) 657 path = os.getcwd()
658 if options.upstream_branch:
659 path += '@' + options.upstream_branch
660 checkouts.append(GuessVCS(options, path))
655 checkouts[0].AutomagicalSettings() 661 checkouts[0].AutomagicalSettings()
656 for item in options.sub_rep: 662 for item in options.sub_rep:
657 checkout = GuessVCS(options, os.path.join(checkouts[0].checkout_root, 663 checkout = GuessVCS(options, os.path.join(checkouts[0].checkout_root,
658 item)) 664 item))
659 if checkout.checkout_root in [c.checkout_root for c in checkouts]: 665 if checkout.checkout_root in [c.checkout_root for c in checkouts]:
660 parser.error('Specified the root %s two times.' % 666 parser.error('Specified the root %s two times.' %
661 checkout.checkout_root) 667 checkout.checkout_root)
662 checkouts.append(checkout) 668 checkouts.append(checkout)
663 669
664 can_http = options.port and options.host 670 can_http = options.port and options.host
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 print >> sys.stderr, e 765 print >> sys.stderr, e
760 return 1 766 return 1
761 except gclient_utils.Error, e: 767 except gclient_utils.Error, e:
762 print >> sys.stderr, e 768 print >> sys.stderr, e
763 return 1 769 return 1
764 return 0 770 return 0
765 771
766 772
767 if __name__ == "__main__": 773 if __name__ == "__main__":
768 sys.exit(TryChange(None, [], False)) 774 sys.exit(TryChange(None, [], False))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698