Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: gclient.py

Issue 1113453007: Add `gclient root` command which outputs the current solution's root. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index 7d0767069d254cf5f83d5f7c02977efb1609b216..21335ce1ae49e1d5b7202ff1ee823e589edf5f41 100755
--- a/gclient.py
+++ b/gclient.py
@@ -1824,6 +1824,16 @@ def CMDgrep(parser, args):
'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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698