Index: recipe_modules/git_cl/api.py |
diff --git a/recipe_modules/git_cl/api.py b/recipe_modules/git_cl/api.py |
index 0cb1f53e308e99302794adef384e686caf976fa8..8d2ad5c0d660600040b50f48ef25ca21420f4f0a 100644 |
--- a/recipe_modules/git_cl/api.py |
+++ b/recipe_modules/git_cl/api.py |
@@ -8,18 +8,34 @@ class GitClApi(recipe_api.RecipeApi): |
def __call__(self, subcmd, args, name=None, **kwargs): |
if not name: |
name = 'git_cl ' + subcmd |
+ |
+ if kwargs.get('suffix'): |
+ name = name + ' (%s)' % kwargs.pop('suffix') |
+ |
if 'cwd' not in kwargs: |
kwargs['cwd'] = (self.c and self.c.repo_location) or None |
return self.m.step( |
- name, [self.package_repo_resource('git_cl.py')] + args, **kwargs) |
+ name, [self.package_repo_resource('git_cl.py'), subcmd] + args, |
+ **kwargs) |
+ |
+ def get_description(self, patch=None, codereview=None, **kwargs): |
+ args = ['-d'] |
+ if patch or codereview: |
+ assert patch and codereview, "Both patch and codereview must be provided" |
+ args.append('--%s' % codereview) |
+ args.append(patch) |
+ |
+ return self('description', args, stdout=self.m.raw_io.output(), **kwargs) |
- def get_description(self, **kwargs): |
- return self('description', ['-d'], stdout=self.m.raw_io.output(), **kwargs) |
+ def set_description(self, description, patch=None, codereview=None, **kwargs): |
+ args = ['-n', '-'] |
+ if patch or codereview: |
+ assert patch and codereview, "Both patch and codereview must be provided" |
+ args.append(patch) |
+ args.append('--%s' % codereview) |
- def set_description(self, description, **kwargs): |
return self( |
- 'description', ['-n', '-'], |
- stdout=self.m.raw_io.output(), |
+ 'description', args, stdout=self.m.raw_io.output(), |
stdin=self.m.raw_io.input(data=description), |
name='git_cl set description', **kwargs) |