| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 if rv: | 286 if rv: |
| 287 msg = 'failed to run command: %s' % ' '.join(command) | 287 msg = 'failed to run command: %s' % ' '.join(command) |
| 288 | 288 |
| 289 if fail_status != None: | 289 if fail_status != None: |
| 290 print >>sys.stderr, msg | 290 print >>sys.stderr, msg |
| 291 sys.exit(fail_status) | 291 sys.exit(fail_status) |
| 292 | 292 |
| 293 raise Error(msg) | 293 raise Error(msg) |
| 294 | 294 |
| 295 | 295 |
| 296 def IsUsingGit(root, paths): | |
| 297 """Returns True if we're using git to manage any of our checkouts. | |
| 298 |entries| is a list of paths to check.""" | |
| 299 for path in paths: | |
| 300 if os.path.exists(os.path.join(root, path, '.git')): | |
| 301 return True | |
| 302 return False | |
| 303 | |
| 304 def FindGclientRoot(from_dir, filename='.gclient'): | 296 def FindGclientRoot(from_dir, filename='.gclient'): |
| 305 """Tries to find the gclient root.""" | 297 """Tries to find the gclient root.""" |
| 306 path = os.path.realpath(from_dir) | 298 path = os.path.realpath(from_dir) |
| 307 while not os.path.exists(os.path.join(path, filename)): | 299 while not os.path.exists(os.path.join(path, filename)): |
| 308 next = os.path.split(path) | 300 next = os.path.split(path) |
| 309 if not next[1]: | 301 if not next[1]: |
| 310 return None | 302 return None |
| 311 path = next[0] | 303 path = next[0] |
| 312 logging.info('Found gclient root at ' + path) | 304 logging.info('Found gclient root at ' + path) |
| 313 return path | 305 return path |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 config_path = FindFileUpwards(config_file, path) | 339 config_path = FindFileUpwards(config_file, path) |
| 348 | 340 |
| 349 if not config_path: | 341 if not config_path: |
| 350 print "Can't find %s" % config_file | 342 print "Can't find %s" % config_file |
| 351 return None | 343 return None |
| 352 | 344 |
| 353 env = {} | 345 env = {} |
| 354 execfile(config_path, env) | 346 execfile(config_path, env) |
| 355 config_dir = os.path.dirname(config_path) | 347 config_dir = os.path.dirname(config_path) |
| 356 return config_dir, env['entries'] | 348 return config_dir, env['entries'] |
| OLD | NEW |