| OLD | NEW |
| 1 # Copyright (c) 2010 Google Inc. All rights reserved. | 1 # Copyright (c) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 | 680 |
| 681 SECONDS_BEFORE_GIVING_UP = 300 | 681 SECONDS_BEFORE_GIVING_UP = 300 |
| 682 | 682 |
| 683 def __init__(self): | 683 def __init__(self): |
| 684 super(AutoRebaseline, self).__init__(options=[ | 684 super(AutoRebaseline, self).__init__(options=[ |
| 685 # FIXME: Remove this option. | 685 # FIXME: Remove this option. |
| 686 self.no_optimize_option, | 686 self.no_optimize_option, |
| 687 # FIXME: Remove this option. | 687 # FIXME: Remove this option. |
| 688 self.results_directory_option, | 688 self.results_directory_option, |
| 689 optparse.make_option("--auth-refresh-token-json", help="Rietveld aut
h refresh JSON token."), | 689 optparse.make_option("--auth-refresh-token-json", help="Rietveld aut
h refresh JSON token."), |
| 690 optparse.make_option("--commit-author", | |
| 691 help='Optionally specify an explicit author for local commit. Fo
rmat as "Name <email>".'), | |
| 692 optparse.make_option("--dry-run", action='store_true', default=False
, | 690 optparse.make_option("--dry-run", action='store_true', default=False
, |
| 693 help='Run without creating a temporary branch, committing locall
y, or uploading/landing ' | 691 help='Run without creating a temporary branch, committing locall
y, or uploading/landing ' |
| 694 'changes to the remote repository.') | 692 'changes to the remote repository.') |
| 695 ]) | 693 ]) |
| 696 self._blame_regex = re.compile(r""" | 694 self._blame_regex = re.compile(r""" |
| 697 ^(\S*) # Commit hash | 695 ^(\S*) # Commit hash |
| 698 [^(]* \( # Whitespace and open parenthesis | 696 [^(]* \( # Whitespace and open parenthesis |
| 699 < # Email address is surrounded by <> | 697 < # Email address is surrounded by <> |
| 700 ( | 698 ( |
| 701 [^@]+ # Username preceding @ | 699 [^@]+ # Username preceding @ |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 tool.scm().create_clean_branch(rebaseline_branch_name) | 894 tool.scm().create_clean_branch(rebaseline_branch_name) |
| 897 did_switch_branches = True | 895 did_switch_branches = True |
| 898 | 896 |
| 899 if test_prefix_list: | 897 if test_prefix_list: |
| 900 self._rebaseline(options, test_prefix_list) | 898 self._rebaseline(options, test_prefix_list) |
| 901 | 899 |
| 902 if options.dry_run: | 900 if options.dry_run: |
| 903 return | 901 return |
| 904 | 902 |
| 905 tool.scm().commit_locally_with_message( | 903 tool.scm().commit_locally_with_message( |
| 906 self.commit_message(author, revision, commit, bugs), | 904 self.commit_message(author, revision, commit, bugs)) |
| 907 author=options.commit_author) | |
| 908 | 905 |
| 909 # FIXME: It would be nice if we could dcommit the patch without uplo
ading, but still | 906 # FIXME: It would be nice if we could dcommit the patch without uplo
ading, but still |
| 910 # go through all the precommit hooks. For rebaselines with lots of f
iles, uploading | 907 # go through all the precommit hooks. For rebaselines with lots of f
iles, uploading |
| 911 # takes a long time and sometimes fails, but we don't want to commit
if, e.g. the | 908 # takes a long time and sometimes fails, but we don't want to commit
if, e.g. the |
| 912 # tree is closed. | 909 # tree is closed. |
| 913 did_finish = self._run_git_cl_command(options, ['upload', '-f']) | 910 did_finish = self._run_git_cl_command(options, ['upload', '-f']) |
| 914 | 911 |
| 915 if did_finish: | 912 if did_finish: |
| 916 # Uploading can take a very long time. Do another pull to make s
ure TestExpectations is up to date, | 913 # Uploading can take a very long time. Do another pull to make s
ure TestExpectations is up to date, |
| 917 # so the dcommit can go through. | 914 # so the dcommit can go through. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 self._tool.scm().checkout_branch(old_branch_name_or_ref) | 1007 self._tool.scm().checkout_branch(old_branch_name_or_ref) |
| 1011 else: | 1008 else: |
| 1012 self._log_queue.put(self.QUIT_LOG) | 1009 self._log_queue.put(self.QUIT_LOG) |
| 1013 log_thread.join() | 1010 log_thread.join() |
| 1014 | 1011 |
| 1015 def execute(self, options, args, tool): | 1012 def execute(self, options, args, tool): |
| 1016 self._verbose = options.verbose | 1013 self._verbose = options.verbose |
| 1017 while True: | 1014 while True: |
| 1018 self._do_one_rebaseline() | 1015 self._do_one_rebaseline() |
| 1019 time.sleep(self.SLEEP_TIME_IN_SECONDS) | 1016 time.sleep(self.SLEEP_TIME_IN_SECONDS) |
| OLD | NEW |