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

Unified Diff: gclient.py

Issue 2862039: Add gclient recurse (Closed)
Patch Set: address review comments Created 10 years, 6 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 | tests/gclient_smoketest.py » ('j') | 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 1b7da5cdc82f0edae49e61b679c379acf7f2234a..80c1217b1bdfbca16a8c79efaaa1bc9883d38145 100644
--- a/gclient.py
+++ b/gclient.py
@@ -57,6 +57,7 @@ import optparse
import os
import pprint
import re
+import subprocess
import sys
import urlparse
import urllib
@@ -856,6 +857,35 @@ Mostly svn-specific. Simply runs 'svn cleanup' for each module.
return client.RunOnDeps('cleanup', args)
+@attr('usage', '[command] [args ...]')
+def CMDrecurse(parser, args):
+ """Operates on all the entries.
+
+ Runs a shell command on all entries.
+ """
+ # Stop parsing at the first non-arg so that these go through to the command
+ parser.disable_interspersed_args()
+ parser.add_option('-s', '--scm', action='append', default=[],
+ help='choose scm types to operate upon')
+ options, args = parser.parse_args(args)
+ root, entries = gclient_utils.GetGClientRootAndEntries()
+ scm_set = set()
+ for scm in options.scm:
+ scm_set.update(scm.split(','))
+
+ # Pass in the SCM type as an env variable
+ env = os.environ.copy()
+
+ for path, url in entries.iteritems():
+ scm = gclient_scm.GetScmName(url)
+ if scm_set and scm not in scm_set:
+ continue
+ dir = os.path.normpath(os.path.join(root, path))
+ env['GCLIENT_SCM'] = scm
+ env['GCLIENT_URL'] = url
+ subprocess.Popen(args, cwd=dir, env=env).communicate()
+
+
@attr('usage', '[url] [safesync url]')
def CMDconfig(parser, args):
"""Create a .gclient file in the current directory.
« no previous file with comments | « no previous file | tests/gclient_smoketest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698