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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 if rv: | 303 if rv: |
304 msg = 'failed to run command: %s' % ' '.join(command) | 304 msg = 'failed to run command: %s' % ' '.join(command) |
305 | 305 |
306 if fail_status != None: | 306 if fail_status != None: |
307 print >>sys.stderr, msg | 307 print >>sys.stderr, msg |
308 sys.exit(fail_status) | 308 sys.exit(fail_status) |
309 | 309 |
310 raise Error(msg) | 310 raise Error(msg) |
311 | 311 |
312 | 312 |
| 313 def IsUsingGit(root, paths): |
| 314 """Returns True if we're using git to manage any of our checkouts. |
| 315 |entries| is a list of paths to check.""" |
| 316 for path in paths: |
| 317 if os.path.exists(os.path.join(root, path, '.git')): |
| 318 return True |
| 319 return False |
| 320 |
313 def FindGclientRoot(from_dir, filename='.gclient'): | 321 def FindGclientRoot(from_dir, filename='.gclient'): |
314 """Tries to find the gclient root.""" | 322 """Tries to find the gclient root.""" |
315 path = os.path.realpath(from_dir) | 323 path = os.path.realpath(from_dir) |
316 while not os.path.exists(os.path.join(path, filename)): | 324 while not os.path.exists(os.path.join(path, filename)): |
317 next = os.path.split(path) | 325 next = os.path.split(path) |
318 if not next[1]: | 326 if not next[1]: |
319 return None | 327 return None |
320 path = next[0] | 328 path = next[0] |
321 logging.info('Found gclient root at ' + path) | 329 logging.info('Found gclient root at ' + path) |
322 return path | 330 return path |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 config_path = FindFileUpwards(config_file, path) | 364 config_path = FindFileUpwards(config_file, path) |
357 | 365 |
358 if not config_path: | 366 if not config_path: |
359 print "Can't find %s" % config_file | 367 print "Can't find %s" % config_file |
360 return None | 368 return None |
361 | 369 |
362 env = {} | 370 env = {} |
363 execfile(config_path, env) | 371 execfile(config_path, env) |
364 config_dir = os.path.dirname(config_path) | 372 config_dir = os.path.dirname(config_path) |
365 return config_dir, env['entries'] | 373 return config_dir, env['entries'] |
OLD | NEW |