Chromium Code Reviews| 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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 | 796 |
| 797 def execute(self, options, args, tool): | 797 def execute(self, options, args, tool): |
| 798 if tool.scm().executable_name == "svn": | 798 if tool.scm().executable_name == "svn": |
| 799 _log.error("Auto rebaseline only works with a git checkout.") | 799 _log.error("Auto rebaseline only works with a git checkout.") |
| 800 return | 800 return |
| 801 | 801 |
| 802 if tool.scm().has_working_directory_changes(): | 802 if tool.scm().has_working_directory_changes(): |
| 803 _log.error("Cannot proceed with working directory changes. Clean wor king directory first.") | 803 _log.error("Cannot proceed with working directory changes. Clean wor king directory first.") |
| 804 return | 804 return |
| 805 | 805 |
| 806 # Setup git-svn for dcommit. | |
| 807 tool.executive.run_command(['git', 'auto-svn']) | |
|
Dirk Pranke
2015/06/12 19:51:30
I wonder if there's much of a cost to running this
joelo
2015/06/17 18:37:37
Good point, done.
| |
| 808 | |
| 806 revision_data = self.bot_revision_data() | 809 revision_data = self.bot_revision_data() |
| 807 if not revision_data: | 810 if not revision_data: |
| 808 return | 811 return |
| 809 | 812 |
| 810 min_revision = int(min([item["revision"] for item in revision_data])) | 813 min_revision = int(min([item["revision"] for item in revision_data])) |
| 811 tests, revision, author, bugs, has_any_needs_rebaseline_lines = self.tes ts_to_rebaseline(tool, min_revision, print_revisions=options.verbose) | 814 tests, revision, author, bugs, has_any_needs_rebaseline_lines = self.tes ts_to_rebaseline(tool, min_revision, print_revisions=options.verbose) |
| 812 | 815 |
| 813 if options.verbose: | 816 if options.verbose: |
| 814 _log.info("Min revision across all bots is %s." % min_revision) | 817 _log.info("Min revision across all bots is %s." % min_revision) |
| 815 for item in revision_data: | 818 for item in revision_data: |
| 816 _log.info("%s: r%s" % (item["builder"], item["revision"])) | 819 _log.info("%s: r%s" % (item["builder"], item["revision"])) |
| 817 | 820 |
| 818 if not tests: | 821 if not tests: |
| 819 _log.debug('No tests to rebaseline.') | 822 _log.debug('No tests to rebaseline.') |
| 820 return | 823 return |
| 821 | 824 |
| 822 if self.tree_status() == 'closed': | 825 if self.tree_status() == 'closed': |
| 823 _log.info('Cannot proceed. Tree is closed.') | 826 _log.info('Cannot proceed. Tree is closed.') |
| 824 return | 827 return |
| 825 | 828 |
| 826 _log.info('Rebaselining %s for r%s by %s.' % (list(tests), revision, aut hor)) | 829 _log.info('Rebaselining %s for r%s by %s.' % (list(tests), revision, aut hor)) |
| 827 | 830 |
| 828 test_prefix_list, lines_to_remove = self.get_test_prefix_list(tests) | 831 test_prefix_list, lines_to_remove = self.get_test_prefix_list(tests) |
| 829 | 832 |
| 830 did_finish = False | 833 did_finish = False |
| 831 try: | 834 try: |
| 832 old_branch_name = tool.scm().current_branch() | 835 old_branch_name = tool.executive.run_command(["git", "rev-parse", "- -symbolic-full-name", "HEAD"]) |
| 836 if old_branch_name == "HEAD": | |
| 837 # If HEAD is detached use commit SHA instead. | |
| 838 old_branch_name = tool.executive.run_command(["git", "rev-parse" , "HEAD"]) | |
| 833 tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME) | 839 tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME) |
| 834 tool.scm().create_clean_branch(self.AUTO_REBASELINE_BRANCH_NAME) | 840 tool.scm().create_clean_branch(self.AUTO_REBASELINE_BRANCH_NAME) |
| 835 | 841 |
| 836 # If the tests are passing everywhere, then this list will be empty. We don't need | 842 # If the tests are passing everywhere, then this list will be empty. We don't need |
| 837 # to rebaseline, but we'll still need to update TestExpectations. | 843 # to rebaseline, but we'll still need to update TestExpectations. |
| 838 if test_prefix_list: | 844 if test_prefix_list: |
| 839 self._rebaseline(options, test_prefix_list) | 845 self._rebaseline(options, test_prefix_list) |
| 840 | 846 |
| 841 tool.scm().commit_locally_with_message(self.commit_message(author, r evision, bugs)) | 847 tool.scm().commit_locally_with_message(self.commit_message(author, r evision, bugs)) |
| 842 | 848 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 self._tool.scm().checkout_branch(old_branch_name) | 940 self._tool.scm().checkout_branch(old_branch_name) |
| 935 else: | 941 else: |
| 936 self._log_queue.put(self.QUIT_LOG) | 942 self._log_queue.put(self.QUIT_LOG) |
| 937 log_thread.join() | 943 log_thread.join() |
| 938 | 944 |
| 939 def execute(self, options, args, tool): | 945 def execute(self, options, args, tool): |
| 940 self._verbose = options.verbose | 946 self._verbose = options.verbose |
| 941 while True: | 947 while True: |
| 942 self._do_one_rebaseline() | 948 self._do_one_rebaseline() |
| 943 time.sleep(self.SLEEP_TIME_IN_SECONDS) | 949 time.sleep(self.SLEEP_TIME_IN_SECONDS) |
| OLD | NEW |