OLD | NEW |
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 Loading... |
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 |
OLD | NEW |