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

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

Issue 2087093002: Add upload and issue to git_cl recipe module (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Re-gen expectations Created 4 years, 5 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_cl/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 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 from recipe_engine import recipe_api 5 from recipe_engine import recipe_api
6 6
7 import string
8
7 class GitClApi(recipe_api.RecipeApi): 9 class GitClApi(recipe_api.RecipeApi):
8 def __call__(self, subcmd, args, name=None, **kwargs): 10 def __call__(self, subcmd, args, name=None, **kwargs):
9 if not name: 11 if not name:
10 name = 'git_cl ' + subcmd 12 name = 'git_cl ' + subcmd
11 13
12 if kwargs.get('suffix'): 14 if kwargs.get('suffix'):
13 name = name + ' (%s)' % kwargs.pop('suffix') 15 name = name + ' (%s)' % kwargs.pop('suffix')
14 16
15 if 'cwd' not in kwargs: 17 if 'cwd' not in kwargs:
16 kwargs['cwd'] = (self.c and self.c.repo_location) or None 18 kwargs['cwd'] = (self.c and self.c.repo_location) or None
(...skipping 15 matching lines...) Expand all
32 args = ['-n', '-'] 34 args = ['-n', '-']
33 if patch or codereview: 35 if patch or codereview:
34 assert patch and codereview, "Both patch and codereview must be provided" 36 assert patch and codereview, "Both patch and codereview must be provided"
35 args.append(patch) 37 args.append(patch)
36 args.append('--%s' % codereview) 38 args.append('--%s' % codereview)
37 39
38 return self( 40 return self(
39 'description', args, stdout=self.m.raw_io.output(), 41 'description', args, stdout=self.m.raw_io.output(),
40 stdin=self.m.raw_io.input(data=description), 42 stdin=self.m.raw_io.input(data=description),
41 name='git_cl set description', **kwargs) 43 name='git_cl set description', **kwargs)
44
45 def upload(self, message, upload_args=None, **kwargs):
46 upload_args = upload_args or []
47
48 upload_args.extend(['--message-file', self.m.raw_io.input(message)])
49
50 return self('upload', upload_args, **kwargs)
51
52 def issue(self, **kwargs):
53 return self('issue', [], stdout=self.m.raw_io.output(), **kwargs)
54
OLDNEW
« no previous file with comments | « no previous file | recipe_modules/git_cl/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698