| 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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 return | 818 return |
| 819 | 819 |
| 820 if self.tree_status() == 'closed': | 820 if self.tree_status() == 'closed': |
| 821 _log.info('Cannot proceed. Tree is closed.') | 821 _log.info('Cannot proceed. Tree is closed.') |
| 822 return | 822 return |
| 823 | 823 |
| 824 _log.info('Rebaselining %s for r%s by %s.' % (list(tests), revision, aut
hor)) | 824 _log.info('Rebaselining %s for r%s by %s.' % (list(tests), revision, aut
hor)) |
| 825 | 825 |
| 826 test_prefix_list, lines_to_remove = self.get_test_prefix_list(tests) | 826 test_prefix_list, lines_to_remove = self.get_test_prefix_list(tests) |
| 827 | 827 |
| 828 did_finish = False |
| 828 try: | 829 try: |
| 829 old_branch_name = tool.scm().current_branch() | 830 old_branch_name = tool.scm().current_branch() |
| 830 tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME) | 831 tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME) |
| 831 tool.scm().create_clean_branch(self.AUTO_REBASELINE_BRANCH_NAME) | 832 tool.scm().create_clean_branch(self.AUTO_REBASELINE_BRANCH_NAME) |
| 832 | 833 |
| 833 # If the tests are passing everywhere, then this list will be empty.
We don't need | 834 # If the tests are passing everywhere, then this list will be empty.
We don't need |
| 834 # to rebaseline, but we'll still need to update TestExpectations. | 835 # to rebaseline, but we'll still need to update TestExpectations. |
| 835 if test_prefix_list: | 836 if test_prefix_list: |
| 836 self._rebaseline(options, test_prefix_list) | 837 self._rebaseline(options, test_prefix_list) |
| 837 | 838 |
| 838 tool.scm().commit_locally_with_message(self.commit_message(author, r
evision, bugs)) | 839 tool.scm().commit_locally_with_message(self.commit_message(author, r
evision, bugs)) |
| 839 | 840 |
| 840 # FIXME: It would be nice if we could dcommit the patch without uplo
ading, but still | 841 # FIXME: It would be nice if we could dcommit the patch without uplo
ading, but still |
| 841 # go through all the precommit hooks. For rebaselines with lots of f
iles, uploading | 842 # go through all the precommit hooks. For rebaselines with lots of f
iles, uploading |
| 842 # takes a long time and sometimes fails, but we don't want to commit
if, e.g. the | 843 # takes a long time and sometimes fails, but we don't want to commit
if, e.g. the |
| 843 # tree is closed. | 844 # tree is closed. |
| 844 did_finish = self._run_git_cl_command(options, ['upload', '-f']) | 845 did_finish = self._run_git_cl_command(options, ['upload', '-f']) |
| 845 | 846 |
| 846 if did_finish: | 847 if did_finish: |
| 847 # Uploading can take a very long time. Do another pull to make s
ure TestExpectations is up to date, | 848 # Uploading can take a very long time. Do another pull to make s
ure TestExpectations is up to date, |
| 848 # so the dcommit can go through. | 849 # so the dcommit can go through. |
| 849 # FIXME: Log the pull and dcommit stdout/stderr to the log-serve
r. | 850 # FIXME: Log the pull and dcommit stdout/stderr to the log-serve
r. |
| 850 tool.executive.run_command(['git', 'pull']) | 851 tool.executive.run_command(['git', 'pull']) |
| 851 | 852 |
| 852 self._run_git_cl_command(options, ['dcommit', '-f']) | 853 self._run_git_cl_command(options, ['dcommit', '-f']) |
| 854 except Exception as e: |
| 855 _log.error(e) |
| 853 finally: | 856 finally: |
| 854 self._run_git_cl_command(options, ['set_close']) | 857 if did_finish: |
| 858 self._run_git_cl_command(options, ['set_close']) |
| 855 tool.scm().ensure_cleanly_tracking_remote_master() | 859 tool.scm().ensure_cleanly_tracking_remote_master() |
| 856 tool.scm().checkout_branch(old_branch_name) | 860 tool.scm().checkout_branch(old_branch_name) |
| 857 tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME) | 861 tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME) |
| 858 | 862 |
| 859 | 863 |
| 860 class RebaselineOMatic(AbstractDeclarativeCommand): | 864 class RebaselineOMatic(AbstractDeclarativeCommand): |
| 861 name = "rebaseline-o-matic" | 865 name = "rebaseline-o-matic" |
| 862 help_text = "Calls webkit-patch auto-rebaseline in a loop." | 866 help_text = "Calls webkit-patch auto-rebaseline in a loop." |
| 863 show_in_main_help = True | 867 show_in_main_help = True |
| 864 | 868 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 # Sometimes git crashes and leaves us on a detached head. | 930 # Sometimes git crashes and leaves us on a detached head. |
| 927 self._tool.scm().checkout_branch(old_branch_name) | 931 self._tool.scm().checkout_branch(old_branch_name) |
| 928 self._log_queue.put(self.QUIT_LOG) | 932 self._log_queue.put(self.QUIT_LOG) |
| 929 log_thread.join() | 933 log_thread.join() |
| 930 | 934 |
| 931 def execute(self, options, args, tool): | 935 def execute(self, options, args, tool): |
| 932 self._verbose = options.verbose | 936 self._verbose = options.verbose |
| 933 while True: | 937 while True: |
| 934 self._do_one_rebaseline() | 938 self._do_one_rebaseline() |
| 935 time.sleep(self.SLEEP_TIME_IN_SECONDS) | 939 time.sleep(self.SLEEP_TIME_IN_SECONDS) |
| OLD | NEW |