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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 """ | 202 """ |
203 | 203 |
204 if print_messages: | 204 if print_messages: |
205 print("\n________ running \'%s\' in \'%s\'" | 205 print("\n________ running \'%s\' in \'%s\'" |
206 % (' '.join(command), in_directory)) | 206 % (' '.join(command), in_directory)) |
207 | 207 |
208 # *Sigh*: Windows needs shell=True, or else it won't search %PATH% for the | 208 # *Sigh*: Windows needs shell=True, or else it won't search %PATH% for the |
209 # executable, but shell=True makes subprocess on Linux fail when it's called | 209 # executable, but shell=True makes subprocess on Linux fail when it's called |
210 # with a list because it only tries to execute the first item in the list. | 210 # with a list because it only tries to execute the first item in the list. |
211 kid = subprocess.Popen(command, bufsize=0, cwd=in_directory, | 211 kid = subprocess.Popen(command, bufsize=0, cwd=in_directory, |
212 shell=(sys.platform == 'win32'), stdout=subprocess.PIPE) | 212 shell=(sys.platform == 'win32'), stdout=subprocess.PIPE, |
| 213 stderr=subprocess.STDOUT) |
213 | 214 |
214 # Also, we need to forward stdout to prevent weird re-ordering of output. | 215 # Also, we need to forward stdout to prevent weird re-ordering of output. |
215 # This has to be done on a per byte basis to make sure it is not buffered: | 216 # This has to be done on a per byte basis to make sure it is not buffered: |
216 # normally buffering is done for each line, but if svn requests input, no | 217 # normally buffering is done for each line, but if svn requests input, no |
217 # end-of-line character is output after the prompt and it would not show up. | 218 # end-of-line character is output after the prompt and it would not show up. |
218 in_byte = kid.stdout.read(1) | 219 in_byte = kid.stdout.read(1) |
219 in_line = "" | 220 in_line = "" |
220 while in_byte: | 221 while in_byte: |
221 if in_byte != "\r": | 222 if in_byte != "\r": |
222 if print_stdout: | 223 if print_stdout: |
(...skipping 20 matching lines...) Expand all Loading... |
243 raise Error(msg) | 244 raise Error(msg) |
244 | 245 |
245 | 246 |
246 def IsUsingGit(root, paths): | 247 def IsUsingGit(root, paths): |
247 """Returns True if we're using git to manage any of our checkouts. | 248 """Returns True if we're using git to manage any of our checkouts. |
248 |entries| is a list of paths to check.""" | 249 |entries| is a list of paths to check.""" |
249 for path in paths: | 250 for path in paths: |
250 if os.path.exists(os.path.join(root, path, '.git')): | 251 if os.path.exists(os.path.join(root, path, '.git')): |
251 return True | 252 return True |
252 return False | 253 return False |
OLD | NEW |