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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py

Issue 2580293002: Style change: Rename error variables "e" -> "error" (Closed)
Patch Set: Rebase and fix formatter unittest. Created 4 years 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
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 command() 112 command()
113 113
114 def _update(self, force_clean=False): 114 def _update(self, force_clean=False):
115 if not self.git.is_cleanly_tracking_remote_master(): 115 if not self.git.is_cleanly_tracking_remote_master():
116 if not force_clean: 116 if not force_clean:
117 confirm = raw_input('This repository has local changes, continue ? (uncommitted changes will be lost) y/n: ') 117 confirm = raw_input('This repository has local changes, continue ? (uncommitted changes will be lost) y/n: ')
118 if not confirm.lower() == 'y': 118 if not confirm.lower() == 'y':
119 return False 119 return False
120 try: 120 try:
121 self.git.ensure_cleanly_tracking_remote_master() 121 self.git.ensure_cleanly_tracking_remote_master()
122 except ScriptError as e: 122 except ScriptError as error:
123 _log.error('Failed to clean repository: %s', e) 123 _log.error('Failed to clean repository: %s', error)
124 return False 124 return False
125 125
126 attempts = 1 126 attempts = 1
127 while attempts <= RETRY_ATTEMPTS: 127 while attempts <= RETRY_ATTEMPTS:
128 if attempts > 1: 128 if attempts > 1:
129 # User may have sent a keyboard interrupt during the wait. 129 # User may have sent a keyboard interrupt during the wait.
130 if not self.connection.is_connected(): 130 if not self.connection.is_connected():
131 return False 131 return False
132 wait = int(UPDATE_WAIT_SECONDS) << (attempts - 1) 132 wait = int(UPDATE_WAIT_SECONDS) << (attempts - 1)
133 if wait < 120: 133 if wait < 120:
134 _log.info('Waiting %s seconds', wait) 134 _log.info('Waiting %s seconds', wait)
135 else: 135 else:
136 _log.info('Waiting %s minutes', wait / 60) 136 _log.info('Waiting %s minutes', wait / 60)
137 time.sleep(wait) 137 time.sleep(wait)
138 _log.info('Pull attempt %s out of %s', attempts, RETRY_ATTEMPTS) 138 _log.info('Pull attempt %s out of %s', attempts, RETRY_ATTEMPTS)
139 try: 139 try:
140 self.git.pull(timeout_seconds=PULL_TIMEOUT_SECONDS) 140 self.git.pull(timeout_seconds=PULL_TIMEOUT_SECONDS)
141 return True 141 return True
142 except ScriptError as e: 142 except ScriptError as error:
143 _log.error('Error pulling from server: %s', e) 143 _log.error('Error pulling from server: %s', error)
144 _log.error('Output: %s', e.output) 144 _log.error('Output: %s', error.output)
145 attempts += 1 145 attempts += 1
146 _log.error('Exceeded pull attempts') 146 _log.error('Exceeded pull attempts')
147 _log.error('Aborting at time: %s', self._time()) 147 _log.error('Aborting at time: %s', self._time())
148 return False 148 return False
149 149
150 def _time(self): 150 def _time(self):
151 return time.strftime('[%x %X %Z]', time.localtime()) 151 return time.strftime('[%x %X %Z]', time.localtime())
152 152
153 def _message_command(self, message): 153 def _message_command(self, message):
154 prefix = '%s:' % self.connection.get_nickname() 154 prefix = '%s:' % self.connection.get_nickname()
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 def __init__(self, tool, announce_path, irc_password): 200 def __init__(self, tool, announce_path, irc_password):
201 threading.Thread.__init__(self) 201 threading.Thread.__init__(self)
202 self.bot = CommitAnnouncer(tool, announce_path, irc_password) 202 self.bot = CommitAnnouncer(tool, announce_path, irc_password)
203 203
204 def run(self): 204 def run(self):
205 self.bot.start() 205 self.bot.start()
206 206
207 def stop(self): 207 def stop(self):
208 self.bot.stop() 208 self.bot.stop()
209 self.join() 209 self.join()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698