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

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

Issue 2663623003: Simplify the initialization of Git objects in Host. (Closed)
Patch Set: Created 3 years, 10 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 UPDATE_WAIT_SECONDS = 10 43 UPDATE_WAIT_SECONDS = 10
44 RETRY_ATTEMPTS = 8 44 RETRY_ATTEMPTS = 8
45 45
46 46
47 class CommitAnnouncer(SingleServerIRCBot): 47 class CommitAnnouncer(SingleServerIRCBot):
48 _commit_detail_format = "%H\n%ae\n%s\n%b" # commit-sha1, author email, subj ect, body 48 _commit_detail_format = "%H\n%ae\n%s\n%b" # commit-sha1, author email, subj ect, body
49 49
50 def __init__(self, tool, announce_path, irc_password): 50 def __init__(self, tool, announce_path, irc_password):
51 SingleServerIRCBot.__init__(self, [(SERVER, PORT, irc_password)], NICKNA ME, NICKNAME) 51 SingleServerIRCBot.__init__(self, [(SERVER, PORT, irc_password)], NICKNA ME, NICKNAME)
52 self.announce_path = announce_path 52 self.announce_path = announce_path
53 self.git = Git(cwd=tool.scm().checkout_root, filesystem=tool.filesystem, executive=tool.executive) 53 self.git = tool.scm(tool.scm().checkout_root)
jeffcarp 2017/01/31 22:24:56 Was wondering why this was named tool, not host, a
qyearsley 2017/02/01 00:58:47 That's right, it is weird :-/ It would probably ma
54 self.commands = { 54 self.commands = {
55 'help': self.help, 55 'help': self.help,
56 'ping': self.ping, 56 'ping': self.ping,
57 'quit': self.stop, 57 'quit': self.stop,
58 } 58 }
59 self.last_commit = None 59 self.last_commit = None
60 60
61 def start(self): 61 def start(self):
62 if not self._update(): 62 if not self._update():
63 return 63 return
(...skipping 136 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