| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 raise Error(msg) | 300 raise Error(msg) |
| 301 | 301 |
| 302 | 302 |
| 303 def IsUsingGit(root, paths): | 303 def IsUsingGit(root, paths): |
| 304 """Returns True if we're using git to manage any of our checkouts. | 304 """Returns True if we're using git to manage any of our checkouts. |
| 305 |entries| is a list of paths to check.""" | 305 |entries| is a list of paths to check.""" |
| 306 for path in paths: | 306 for path in paths: |
| 307 if os.path.exists(os.path.join(root, path, '.git')): | 307 if os.path.exists(os.path.join(root, path, '.git')): |
| 308 return True | 308 return True |
| 309 return False | 309 return False |
| 310 |
| 311 def FindGclientRoot(from_dir): |
| 312 """Tries to find the gclient root.""" |
| 313 path = os.path.realpath(from_dir) |
| 314 while not os.path.exists(os.path.join(path, '.gclient')): |
| 315 next = os.path.split(path) |
| 316 if not next[1]: |
| 317 return None |
| 318 path = next[0] |
| 319 return path |
| OLD | NEW |