Chromium Code Reviews| Index: recipe_modules/git/api.py | 
| diff --git a/recipe_modules/git/api.py b/recipe_modules/git/api.py | 
| index dddb1de8001f21eaadc096e6fece09797b1841c2..52f2494ead376b382f2f8801afe908b9d2ff3a6d 100644 | 
| --- a/recipe_modules/git/api.py | 
| +++ b/recipe_modules/git/api.py | 
| @@ -409,3 +409,21 @@ class GitApi(recipe_api.RecipeApi): | 
| if not rev_list_args: | 
| rev_list_args = ['--all'] | 
| self('bundle', 'create', bundle_path, *rev_list_args, **kwargs) | 
| + | 
| + def new_branch(self, branch, name=None, upstream=None, **kwargs): | 
| + """Runs git new-branch on a Git repository, to be used before git cl upload. | 
| + | 
| + Args: | 
| + branch: new branch name, which must not yet exist. | 
| + name: step name. | 
| + 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
 
 | 
| + """ | 
| + env = kwargs.pop('env', {}) | 
| + env['PATH'] = self.m.path.pathsep.join([ | 
| + 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
 
 | 
| + args = ['new-branch', branch] | 
| + if upstream: | 
| + args.extend(['--upstream', upstream]) | 
| + if not name: | 
| + name = 'git new-branch %s' % branch | 
| + return self(*args, name=name, env=env, **kwargs) |