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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 835 | 835 |
| 836 did_finish = False | 836 did_finish = False |
| 837 try: | 837 try: |
| 838 # Setup git-svn for dcommit if necessary. | 838 # Setup git-svn for dcommit if necessary. |
| 839 if tool.executive.run_command( | 839 if tool.executive.run_command( |
| 840 ['git', 'config', '--local', '--get-regexp', r'^svn-remote\. '], | 840 ['git', 'config', '--local', '--get-regexp', r'^svn-remote\. '], |
| 841 return_exit_code=True): | 841 return_exit_code=True): |
| 842 tool.executive.run_command(['git', 'auto-svn']) | 842 tool.executive.run_command(['git', 'auto-svn']) |
| 843 | 843 |
| 844 # Save the current branch name and checkout a clean branch for the p atch. | 844 # Save the current branch name and checkout a clean branch for the p atch. |
| 845 old_branch_name = tool.executive.run_command( | 845 old_branch_name = self._tool.scm().current_branch() |
| 846 ["git", "rev-parse", "--symbolic-full-name", "HEAD"]) | 846 if not old_branch_name: |
|
Xianzhu
2015/07/16 22:01:19
Why don't use the same method as for rebaseline-o-
joelo
2015/07/16 23:00:11
I'm not quite sure what you mean by this. I change
Xianzhu
2015/07/16 23:21:39
I was just wondering why rebaseline-o-matic assert
| |
| 847 if old_branch_name == "HEAD": | |
| 848 # If HEAD is detached use commit SHA instead. | 847 # If HEAD is detached use commit SHA instead. |
| 849 old_branch_name = tool.executive.run_command(["git", "rev-parse" , "HEAD"]) | 848 old_branch_name = tool.executive.run_command(["git", "rev-parse" , "HEAD"]).strip() |
|
Xianzhu
2015/07/16 22:01:19
Should use single quotes to keep consistency.
joelo
2015/07/16 23:00:11
Done. Sorry, this file is not consistent at all.
Xianzhu
2015/07/16 23:21:39
Never mind. I didn't notice the inconsistency.
| |
| 850 tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME) | 849 tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME) |
| 851 tool.scm().create_clean_branch(self.AUTO_REBASELINE_BRANCH_NAME) | 850 tool.scm().create_clean_branch(self.AUTO_REBASELINE_BRANCH_NAME) |
| 852 | 851 |
| 853 # If the tests are passing everywhere, then this list will be empty. We don't need | 852 # If the tests are passing everywhere, then this list will be empty. We don't need |
| 854 # to rebaseline, but we'll still need to update TestExpectations. | 853 # to rebaseline, but we'll still need to update TestExpectations. |
| 855 if test_prefix_list: | 854 if test_prefix_list: |
| 856 self._rebaseline(options, test_prefix_list) | 855 self._rebaseline(options, test_prefix_list) |
| 857 | 856 |
| 858 tool.scm().commit_locally_with_message(self.commit_message(author, r evision, bugs)) | 857 tool.scm().commit_locally_with_message(self.commit_message(author, r evision, bugs)) |
| 859 | 858 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 while out: | 936 while out: |
| 938 # FIXME: This should probably batch up lines if they're available an d log to the server once. | 937 # FIXME: This should probably batch up lines if they're available an d log to the server once. |
| 939 out = self._log_line(process.stdout) | 938 out = self._log_line(process.stdout) |
| 940 | 939 |
| 941 def _do_one_rebaseline(self): | 940 def _do_one_rebaseline(self): |
| 942 self._log_queue = Queue.Queue(256) | 941 self._log_queue = Queue.Queue(256) |
| 943 log_thread = threading.Thread(name='LogToServer', target=self._log_to_se rver_thread) | 942 log_thread = threading.Thread(name='LogToServer', target=self._log_to_se rver_thread) |
| 944 log_thread.start() | 943 log_thread.start() |
| 945 try: | 944 try: |
| 946 old_branch_name = self._tool.scm().current_branch() | 945 old_branch_name = self._tool.scm().current_branch() |
| 946 assert old_branch_name, ( | |
| 947 "Rebaseline-o-matic cannot be run from a branch with a detached HEAD.") | |
|
Xianzhu
2015/07/16 22:01:19
Ditto.
| |
| 947 self._run_logged_command(['git', 'pull']) | 948 self._run_logged_command(['git', 'pull']) |
| 948 rebaseline_command = [self._tool.filesystem.join(self._tool.scm().ch eckout_root, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline'] | 949 rebaseline_command = [self._tool.filesystem.join(self._tool.scm().ch eckout_root, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline'] |
| 949 if self._verbose: | 950 if self._verbose: |
| 950 rebaseline_command.append('--verbose') | 951 rebaseline_command.append('--verbose') |
| 951 self._run_logged_command(rebaseline_command) | 952 self._run_logged_command(rebaseline_command) |
| 952 except: | 953 except: |
| 953 self._log_queue.put(self.QUIT_LOG) | 954 self._log_queue.put(self.QUIT_LOG) |
| 954 traceback.print_exc(file=sys.stderr) | 955 traceback.print_exc(file=sys.stderr) |
| 955 # Sometimes git crashes and leaves us on a detached head. | 956 # Sometimes git crashes and leaves us on a detached head. |
| 956 self._tool.scm().checkout_branch(old_branch_name) | 957 if old_branch_name: |
| 958 self._tool.scm().checkout_branch(old_branch_name) | |
| 957 else: | 959 else: |
| 958 self._log_queue.put(self.QUIT_LOG) | 960 self._log_queue.put(self.QUIT_LOG) |
| 959 log_thread.join() | 961 log_thread.join() |
| 960 | 962 |
| 961 def execute(self, options, args, tool): | 963 def execute(self, options, args, tool): |
| 962 self._verbose = options.verbose | 964 self._verbose = options.verbose |
| 963 while True: | 965 while True: |
| 964 self._do_one_rebaseline() | 966 self._do_one_rebaseline() |
| 965 time.sleep(self.SLEEP_TIME_IN_SECONDS) | 967 time.sleep(self.SLEEP_TIME_IN_SECONDS) |
| OLD | NEW |