Add `gclient root` command which outputs the current solution's root.
NOPRESUBMIT=true
Review URL: https://codereview.chromium.org/1113453007
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295075 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient.py b/gclient.py
index 7d07670..21335ce 100755
--- a/gclient.py
+++ b/gclient.py
@@ -1824,6 +1824,16 @@
'git', 'grep', '--null', '--color=Always'] + args)
+def CMDroot(parser, args):
+ """Outputs the solution root (or current dir if there isn't one)."""
+ (options, args) = parser.parse_args(args)
+ client = GClient.LoadCurrentConfig(options)
+ if client:
+ print(os.path.abspath(client.root_dir))
+ else:
+ print(os.path.abspath('.'))
+
+
@subcommand.usage('[url] [safesync url]')
def CMDconfig(parser, args):
"""Creates a .gclient file in the current directory.