Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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: new branch name, which must not yet exist. | |
| 418 name: step name. | |
| 419 upstream: to origin/master. | |
|
qyearsley
2016/09/26 16:33:14
(1) "to origin/master" -> "upstream branch name, d
tandrii(chromium)
2016/09/26 16:49:56
I think so, as it's shown when you do $ git branch
| |
| 420 """ | |
| 421 env = kwargs.pop('env', {}) | |
| 422 env['PATH'] = self.m.path.pathsep.join([ | |
| 423 str(self.package_repo_resource()), '%(PATH)s']) | |
|
qyearsley
2016/09/26 16:33:14
I guess that this is required because git-new-bran
tandrii(chromium)
2016/09/26 16:49:56
yep
| |
| 424 args = ['new-branch', branch] | |
| 425 if upstream: | |
| 426 args.extend(['--upstream', upstream]) | |
| 427 if not name: | |
| 428 name = 'git new-branch %s' % branch | |
| 429 return self(*args, name=name, env=env, **kwargs) | |
| OLD | NEW |