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

Unified Diff: recipe_engine/remote.py

Issue 2839353003: [recipes.py] move remote arg parsing to its module (Closed)
Patch Set: rebase Created 3 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 | recipes.py » ('j') | recipes.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_engine/remote.py
diff --git a/recipe_engine/remote.py b/recipe_engine/remote.py
index 790d5557bc4eef0992038aa5c89b199e671ac8ee..e2a2e6e7b602eaeb6ede992b5352718e0cf9da55 100644
--- a/recipe_engine/remote.py
+++ b/recipe_engine/remote.py
@@ -32,7 +32,39 @@ def ensure_workdir(args):
shutil.rmtree(args.workdir, ignore_errors=True)
-def main(args):
+def add_subparser(parser):
+ remote_p = parser.add_parser(
+ 'remote',
+ description='Invoke a recipe command from specified repo and revision')
+ remote_p.add_argument(
+ '--repository', required=True,
+ help='URL of a git repository to fetch')
+ remote_p.add_argument(
+ '--revision',
+ help=(
+ 'Git commit hash to check out; defaults to latest revision on master'
+ ' (refs/heads/master)'
+ ))
+ remote_p.add_argument(
+ '--workdir',
+ type=os.path.abspath,
+ help='The working directory of repo checkout')
+ remote_p.add_argument(
+ '--use-gitiles', action='store_true',
+ help='Use Gitiles-specific way to fetch repo (potentially cheaper for '
+ 'large repos)')
+ remote_p.add_argument(
+ 'remote_args', nargs='*',
+ help='Arguments to pass to fetched repo\'s recipes.py')
+
+ remote_p.set_defaults(
+ command='remote',
+ bare_command=True,
+ func=main,
+ )
+
+
+def main(_package_deps, args):
with ensure_workdir(args):
checkout_dir = os.path.join(args.workdir, 'checkout')
revision = args.revision or 'refs/heads/master'
« no previous file with comments | « no previous file | recipes.py » ('j') | recipes.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698