Index: gclient_utils.py |
diff --git a/gclient_utils.py b/gclient_utils.py |
index 4944cf96744b4771402fd9c8ad33cbccbc879af5..97d05edd12893eef56e7b4543cbae3db94b30411 100644 |
--- a/gclient_utils.py |
+++ b/gclient_utils.py |
@@ -307,3 +307,13 @@ def IsUsingGit(root, paths): |
if os.path.exists(os.path.join(root, path, '.git')): |
return True |
return False |
+ |
+def FindGclientRoot(from_dir): |
+ """Tries to find the gclient root.""" |
+ path = os.path.realpath(from_dir) |
+ while not os.path.exists(os.path.join(path, '.gclient')): |
+ next = os.path.split(path) |
+ if not next[1]: |
+ return None |
+ path = next[0] |
+ return path |