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

Side by Side Diff: recipe_engine/remote_run.py

Issue 2071443003: Introduce different repo types (git and gitiles) (Closed) Base URL: https://github.com/luci/recipes-py.git@master
Patch Set: rename Created 4 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 unified diff | Download patch
« no previous file with comments | « recipe_engine/package_pb2.py ('k') | recipe_engine/unittests/fetch_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The LUCI Authors. All rights reserved. 1 # Copyright 2016 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 from __future__ import print_function 5 from __future__ import print_function
6 6
7 import contextlib 7 import contextlib
8 import logging 8 import logging
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 18 matching lines...) Expand all
29 finally: 29 finally:
30 if workdir_tempdir: 30 if workdir_tempdir:
31 shutil.rmtree(args.workdir, ignore_errors=True) 31 shutil.rmtree(args.workdir, ignore_errors=True)
32 32
33 33
34 def main(args): 34 def main(args):
35 with ensure_workdir(args): 35 with ensure_workdir(args):
36 checkout_dir = os.path.join(args.workdir, 'checkout') 36 checkout_dir = os.path.join(args.workdir, 'checkout')
37 if args.use_gitiles: 37 if args.use_gitiles:
38 args.revision = args.revision or 'HEAD' 38 args.revision = args.revision or 'HEAD'
39 fetch.ensure_gitiles_checkout( 39 backend = fetch.GitilesBackend()
40 args.repository, args.revision, checkout_dir, allow_fetch=True)
41 else: 40 else:
42 args.revision = args.revision or 'FETCH_HEAD' 41 args.revision = args.revision or 'FETCH_HEAD'
43 fetch.ensure_git_checkout( 42 backend = fetch.GitBackend()
44 args.repository, args.revision, checkout_dir, allow_fetch=True) 43 backend.checkout(
44 args.repository, args.revision, checkout_dir, allow_fetch=True)
45 recipes_cfg = package.ProtoFile( 45 recipes_cfg = package.ProtoFile(
46 package.InfraRepoConfig().to_recipes_cfg(checkout_dir)) 46 package.InfraRepoConfig().to_recipes_cfg(checkout_dir))
47 cmd = [ 47 cmd = [
48 sys.executable, 48 sys.executable,
49 os.path.join( 49 os.path.join(
50 checkout_dir, 50 checkout_dir,
51 recipes_cfg.read().recipes_path, 51 recipes_cfg.read().recipes_path,
52 'recipes.py'), 52 'recipes.py'),
53 'run' 53 'run'
54 ] + args.run_args 54 ] + args.run_args
55 logging.info('Running %r', cmd) 55 logging.info('Running %r', cmd)
56 return subprocess.call(cmd) 56 return subprocess.call(cmd)
OLDNEW
« no previous file with comments | « recipe_engine/package_pb2.py ('k') | recipe_engine/unittests/fetch_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698