OLD | NEW |
1 # Copyright 2009 Google Inc. All Rights Reserved. | 1 # Copyright 2009 Google Inc. All Rights Reserved. |
2 # | 2 # |
3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
6 # | 6 # |
7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
8 # | 8 # |
9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 # Also, we need to forward stdout to prevent weird re-ordering of output. | 209 # Also, we need to forward stdout to prevent weird re-ordering of output. |
210 # This has to be done on a per byte basis to make sure it is not buffered: | 210 # This has to be done on a per byte basis to make sure it is not buffered: |
211 # normally buffering is done for each line, but if svn requests input, no | 211 # normally buffering is done for each line, but if svn requests input, no |
212 # end-of-line character is output after the prompt and it would not show up. | 212 # end-of-line character is output after the prompt and it would not show up. |
213 in_byte = kid.stdout.read(1) | 213 in_byte = kid.stdout.read(1) |
214 in_line = "" | 214 in_line = "" |
215 while in_byte: | 215 while in_byte: |
216 if in_byte != "\r": | 216 if in_byte != "\r": |
217 if print_stdout: | 217 if print_stdout: |
218 if not print_messages: | |
219 print("\n________ running \'%s\' in \'%s\'" | |
220 % (' '.join(command), in_directory)) | |
221 print_messages = True | |
222 sys.stdout.write(in_byte) | 218 sys.stdout.write(in_byte) |
223 if in_byte != "\n": | 219 if in_byte != "\n": |
224 in_line += in_byte | 220 in_line += in_byte |
225 if in_byte == "\n" and filter: | 221 if in_byte == "\n" and filter: |
226 filter(in_line) | 222 filter(in_line) |
227 in_line = "" | 223 in_line = "" |
228 in_byte = kid.stdout.read(1) | 224 in_byte = kid.stdout.read(1) |
229 rv = kid.wait() | 225 rv = kid.wait() |
230 | 226 |
231 if rv: | 227 if rv: |
232 msg = "failed to run command: %s" % " ".join(command) | 228 msg = "failed to run command: %s" % " ".join(command) |
233 | 229 |
234 if fail_status != None: | 230 if fail_status != None: |
235 print >>sys.stderr, msg | 231 print >>sys.stderr, msg |
236 sys.exit(fail_status) | 232 sys.exit(fail_status) |
237 | 233 |
238 raise Error(msg) | 234 raise Error(msg) |
239 | 235 |
240 | 236 |
241 def IsUsingGit(root, paths): | 237 def IsUsingGit(root, paths): |
242 """Returns True if we're using git to manage any of our checkouts. | 238 """Returns True if we're using git to manage any of our checkouts. |
243 |entries| is a list of paths to check.""" | 239 |entries| is a list of paths to check.""" |
244 for path in paths: | 240 for path in paths: |
245 if os.path.exists(os.path.join(root, path, '.git')): | 241 if os.path.exists(os.path.join(root, path, '.git')): |
246 return True | 242 return True |
247 return False | 243 return False |
OLD | NEW |