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

Side by Side Diff: Tools/Scripts/webkitpy/tool/commands/rebaseline.py

Issue 327633003: Fix rebaseline-o-matic logging. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months 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 | Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 # newentry flag is set. In that case it starts a new entry to 870 # newentry flag is set. In that case it starts a new entry to
871 # start appending to. 871 # start appending to.
872 def _log_to_server(self, log='', is_new_entry=False): 872 def _log_to_server(self, log='', is_new_entry=False):
873 query = { 873 query = {
874 'log': log, 874 'log': log,
875 } 875 }
876 if is_new_entry: 876 if is_new_entry:
877 query['newentry'] = 'on' 877 query['newentry'] = 'on'
878 urllib2.urlopen("http://" + self.LOG_SERVER + "/updatelog", data=urllib. urlencode(query)) 878 urllib2.urlopen("http://" + self.LOG_SERVER + "/updatelog", data=urllib. urlencode(query))
879 879
880 def _log_line(self, handle):
881 out = handle.readline().rstrip('\n')
882 if out:
883 if self._verbose:
884 print out
885 self._log_to_server(out)
886 return out
887
888 def _log_remaining_lines(self, handle):
889 out = self._log_line(handle)
890 while out:
891 out = self._log_line(handle)
892
880 def _run_logged_command(self, command): 893 def _run_logged_command(self, command):
881 process = self._tool.executive.popen(command, stdout=self._tool.executiv e.PIPE, stderr=self._tool.executive.PIPE) 894 process = self._tool.executive.popen(command, stdout=self._tool.executiv e.PIPE, stderr=self._tool.executive.PIPE)
882 while process.poll() == None: 895 while process.poll() == None:
883 # FIXME: This should probably batch up lines if they're available an d log to the server once. 896 # FIXME: This should probably batch up lines if they're available an d log to the server once.
884 out = process.stdout.readline() 897 self._log_line(process.stdout)
885 if out: 898 self._log_line(process.stderr)
886 self._log_to_server(out)
887 899
888 err = process.stderr.readline() 900 self._log_remaining_lines(process.stdout)
889 if err: 901 self._log_remaining_lines(process.stderr)
890 self._log_to_server(err)
891 902
892 def _do_one_rebaseline(self, verbose): 903 def _do_one_rebaseline(self):
893 try: 904 try:
894 old_branch_name = self._tool.scm().current_branch() 905 old_branch_name = self._tool.scm().current_branch()
895 self._log_to_server(is_new_entry=True) 906 self._log_to_server(is_new_entry=True)
896 self._run_logged_command(['git', 'pull']) 907 self._run_logged_command(['git', 'pull'])
897 rebaseline_command = [self._tool.filesystem.join(self._tool.scm().ch eckout_root, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline'] 908 rebaseline_command = [self._tool.filesystem.join(self._tool.scm().ch eckout_root, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline']
898 if verbose: 909 if self._verbose:
899 rebaseline_command.append('--verbose') 910 rebaseline_command.append('--verbose')
900 self._run_logged_command(rebaseline_command) 911 self._run_logged_command(rebaseline_command)
901 except: 912 except:
902 traceback.print_exc(file=sys.stderr) 913 traceback.print_exc(file=sys.stderr)
903 # Sometimes git crashes and leaves us on a detached head. 914 # Sometimes git crashes and leaves us on a detached head.
904 self._tool.scm().checkout_branch(old_branch_name) 915 self._tool.scm().checkout_branch(old_branch_name)
905 916
906 def execute(self, options, args, tool): 917 def execute(self, options, args, tool):
918 self._verbose = options.verbose
907 while True: 919 while True:
908 self._do_one_rebaseline(options.verbose) 920 self._do_one_rebaseline()
909 time.sleep(self.SLEEP_TIME_IN_SECONDS) 921 time.sleep(self.SLEEP_TIME_IN_SECONDS)
OLDNEW
« no previous file with comments | « no previous file | Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698