| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 # Also, we need to forward stdout to prevent weird re-ordering of output. | 214 # 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: | 215 # 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 | 216 # 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. | 217 # end-of-line character is output after the prompt and it would not show up. |
| 218 in_byte = kid.stdout.read(1) | 218 in_byte = kid.stdout.read(1) |
| 219 in_line = "" | 219 in_line = "" |
| 220 while in_byte: | 220 while in_byte: |
| 221 if in_byte != "\r": | 221 if in_byte != "\r": |
| 222 if print_stdout: | 222 if print_stdout: |
| 223 sys.stdout.write(in_byte) | |
| 224 if not print_messages: | 223 if not print_messages: |
| 225 print("\n________ running \'%s\' in \'%s\'" | 224 print("\n________ running \'%s\' in \'%s\'" |
| 226 % (' '.join(command), in_directory)) | 225 % (' '.join(command), in_directory)) |
| 227 print_messages = True | 226 print_messages = True |
| 227 sys.stdout.write(in_byte) |
| 228 if in_byte != "\n": | 228 if in_byte != "\n": |
| 229 in_line += in_byte | 229 in_line += in_byte |
| 230 if in_byte == "\n" and filter: | 230 if in_byte == "\n" and filter: |
| 231 filter(in_line) | 231 filter(in_line) |
| 232 in_line = "" | 232 in_line = "" |
| 233 in_byte = kid.stdout.read(1) | 233 in_byte = kid.stdout.read(1) |
| 234 rv = kid.wait() | 234 rv = kid.wait() |
| 235 | 235 |
| 236 if rv: | 236 if rv: |
| 237 msg = "failed to run command: %s" % " ".join(command) | 237 msg = "failed to run command: %s" % " ".join(command) |
| 238 | 238 |
| 239 if fail_status != None: | 239 if fail_status != None: |
| 240 print >>sys.stderr, msg | 240 print >>sys.stderr, msg |
| 241 sys.exit(fail_status) | 241 sys.exit(fail_status) |
| 242 | 242 |
| 243 raise Error(msg) | 243 raise Error(msg) |
| 244 | 244 |
| 245 | 245 |
| 246 def IsUsingGit(root, paths): | 246 def IsUsingGit(root, paths): |
| 247 """Returns True if we're using git to manage any of our checkouts. | 247 """Returns True if we're using git to manage any of our checkouts. |
| 248 |entries| is a list of paths to check.""" | 248 |entries| is a list of paths to check.""" |
| 249 for path in paths: | 249 for path in paths: |
| 250 if os.path.exists(os.path.join(root, path, '.git')): | 250 if os.path.exists(os.path.join(root, path, '.git')): |
| 251 return True | 251 return True |
| 252 return False | 252 return False |
| OLD | NEW |