Incremental changes towards more efficient refactoring of gclient.py
Fix gclient diff & pack to not throw uncatched exceptions when a directory is missing.
Reorder things in gclient.py for easier diff later
Update revinfo help
Add GetScmName(), it will be needed later.
TEST=unit tests
BUG=none
Review URL: http://codereview.chromium.org/2786013
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@49565 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_utils.py b/gclient_utils.py
index 327dfe4..3297e63 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -301,10 +301,10 @@
return True
return False
-def FindGclientRoot(from_dir):
+def FindGclientRoot(from_dir, filename='.gclient'):
"""Tries to find the gclient root."""
path = os.path.realpath(from_dir)
- while not os.path.exists(os.path.join(path, '.gclient')):
+ while not os.path.exists(os.path.join(path, filename)):
next = os.path.split(path)
if not next[1]:
return None
@@ -312,6 +312,7 @@
logging.info('Found gclient root at ' + path)
return path
+
def PathDifference(root, subpath):
"""Returns the difference subpath minus root."""
root = os.path.realpath(root)