OLD | NEW |
1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 if code != 0: | 121 if code != 0: |
122 self._SendResponse("Error trying to check out base revision.") | 122 self._SendResponse("Error trying to check out base revision.") |
123 return False | 123 return False |
124 code = self._Call("git clean -f -d") | 124 code = self._Call("git clean -f -d") |
125 if code != 0: | 125 if code != 0: |
126 self._SendResponse("Failed to reset checkout") | 126 self._SendResponse("Failed to reset checkout") |
127 return False | 127 return False |
128 return True | 128 return True |
129 | 129 |
130 def _ApplyPatch(self, patch): | 130 def _ApplyPatch(self, patch): |
| 131 if not patch: return True # Just skip if the patch is empty. |
131 patchfilename = "_dtest_incoming_patch.patch" | 132 patchfilename = "_dtest_incoming_patch.patch" |
132 with open(patchfilename, "w") as f: | 133 with open(patchfilename, "w") as f: |
133 f.write(patch) | 134 f.write(patch) |
134 code = self._Call("git apply %s" % patchfilename) | 135 code = self._Call("git apply %s" % patchfilename) |
135 if code != 0: | 136 if code != 0: |
136 self._SendResponse("Error applying patch.") | 137 self._SendResponse("Error applying patch.") |
137 return False | 138 return False |
138 return True | 139 return True |
139 | 140 |
140 def _Call(self, cmd): | 141 def _Call(self, cmd): |
141 return subprocess.call(cmd, shell=True) | 142 return subprocess.call(cmd, shell=True) |
142 | 143 |
143 | 144 |
144 class WorkSocketServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): | 145 class WorkSocketServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): |
145 def __init__(self, daemon): | 146 def __init__(self, daemon): |
146 address = (daemon.ip, constants.PEER_PORT) | 147 address = (daemon.ip, constants.PEER_PORT) |
147 SocketServer.TCPServer.__init__(self, address, WorkHandler) | 148 SocketServer.TCPServer.__init__(self, address, WorkHandler) |
148 self.job_lock = threading.Lock() | 149 self.job_lock = threading.Lock() |
149 self.daemon = daemon | 150 self.daemon = daemon |
OLD | NEW |