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

Side by Side Diff: recipe_modules/git/api.py

Issue 2369073002: git recipe_module: git new-branch. (Closed)
Patch Set: Review. Created 4 years, 2 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 | « no previous file | recipe_modules/git/example.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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import itertools 5 import itertools
6 import re 6 import re
7 7
8 from recipe_engine import recipe_api 8 from recipe_engine import recipe_api
9 9
10 class GitApi(recipe_api.RecipeApi): 10 class GitApi(recipe_api.RecipeApi):
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 Args: 403 Args:
404 bundle_path (Path): The path of the output bundle. 404 bundle_path (Path): The path of the output bundle.
405 refs (list): The list of refs to include in the bundle. If None, all 405 refs (list): The list of refs to include in the bundle. If None, all
406 refs in the Git checkout will be bundled. 406 refs in the Git checkout will be bundled.
407 kwargs: Forwarded to '__call__'. 407 kwargs: Forwarded to '__call__'.
408 """ 408 """
409 if not rev_list_args: 409 if not rev_list_args:
410 rev_list_args = ['--all'] 410 rev_list_args = ['--all']
411 self('bundle', 'create', bundle_path, *rev_list_args, **kwargs) 411 self('bundle', 'create', bundle_path, *rev_list_args, **kwargs)
412
413 def new_branch(self, branch, name=None, upstream=None, **kwargs):
414 """Runs git new-branch on a Git repository, to be used before git cl upload.
415
416 Args:
417 branch (str): new branch name, which must not yet exist.
418 name (str): step name.
419 upstream (str): to origin/master.
420 kwargs: Forwarded to '__call__'.
421 """
422 env = kwargs.pop('env', {})
423 env['PATH'] = self.m.path.pathsep.join([
424 str(self.package_repo_resource()), '%(PATH)s'])
425 args = ['new-branch', branch]
426 if upstream:
427 args.extend(['--upstream', upstream])
428 if not name:
429 name = 'git new-branch %s' % branch
430 return self(*args, name=name, env=env, **kwargs)
OLDNEW
« no previous file with comments | « no previous file | recipe_modules/git/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698