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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 shell=(sys.platform == 'win32'), stdout=subprocess.PIPE) | 207 shell=(sys.platform == 'win32'), stdout=subprocess.PIPE) |
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 not print_messages: | |
M-A Ruel
2009/10/27 23:31:13
Move this inside the print_stdout. You don't want
Dirk Pranke
2009/10/27 23:44:30
Are you sure? In the old version we would've print
| |
218 print("\n________ running \'%s\' in \'%s\'" | |
219 % (' '.join(command), in_directory)) | |
220 print_messages = True | |
217 if print_stdout: | 221 if print_stdout: |
218 sys.stdout.write(in_byte) | 222 sys.stdout.write(in_byte) |
219 if in_byte != "\n": | 223 if in_byte != "\n": |
220 in_line += in_byte | 224 in_line += in_byte |
221 if in_byte == "\n" and filter: | 225 if in_byte == "\n" and filter: |
222 filter(in_line) | 226 filter(in_line) |
223 in_line = "" | 227 in_line = "" |
224 in_byte = kid.stdout.read(1) | 228 in_byte = kid.stdout.read(1) |
225 rv = kid.wait() | 229 rv = kid.wait() |
226 | 230 |
227 if rv: | 231 if rv: |
228 msg = "failed to run command: %s" % " ".join(command) | 232 msg = "failed to run command: %s" % " ".join(command) |
229 | 233 |
230 if fail_status != None: | 234 if fail_status != None: |
231 print >>sys.stderr, msg | 235 print >>sys.stderr, msg |
232 sys.exit(fail_status) | 236 sys.exit(fail_status) |
233 | 237 |
234 raise Error(msg) | 238 raise Error(msg) |
235 | 239 |
236 | 240 |
237 def IsUsingGit(root, paths): | 241 def IsUsingGit(root, paths): |
238 """Returns True if we're using git to manage any of our checkouts. | 242 """Returns True if we're using git to manage any of our checkouts. |
239 |entries| is a list of paths to check.""" | 243 |entries| is a list of paths to check.""" |
240 for path in paths: | 244 for path in paths: |
241 if os.path.exists(os.path.join(root, path, '.git')): | 245 if os.path.exists(os.path.join(root, path, '.git')): |
242 return True | 246 return True |
243 return False | 247 return False |
OLD | NEW |