Commit 808d7ea4 authored by martiniss's avatar martiniss Committed by Commit bot

Add upload and issue to git_cl recipe module

Depends on https://codereview.chromium.org/2088343002

Review-Url: https://codereview.chromium.org/2087093002
parent 8c51b6f1
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
from recipe_engine import recipe_api from recipe_engine import recipe_api
import string
class GitClApi(recipe_api.RecipeApi): class GitClApi(recipe_api.RecipeApi):
def __call__(self, subcmd, args, name=None, **kwargs): def __call__(self, subcmd, args, name=None, **kwargs):
if not name: if not name:
...@@ -39,3 +41,14 @@ class GitClApi(recipe_api.RecipeApi): ...@@ -39,3 +41,14 @@ class GitClApi(recipe_api.RecipeApi):
'description', args, stdout=self.m.raw_io.output(), 'description', args, stdout=self.m.raw_io.output(),
stdin=self.m.raw_io.input(data=description), stdin=self.m.raw_io.input(data=description),
name='git_cl set description', **kwargs) name='git_cl set description', **kwargs)
def upload(self, message, upload_args=None, **kwargs):
upload_args = upload_args or []
upload_args.extend(['--message-file', self.m.raw_io.input(message)])
return self('upload', upload_args, **kwargs)
def issue(self, **kwargs):
return self('issue', [], stdout=self.m.raw_io.output(), **kwargs)
[ [
{
"cmd": [
"RECIPE_PACKAGE_REPO[depot_tools]/git_cl.py",
"upload",
"--message-file",
"Do the thing foobar\nNow with emoji: \ud83d\ude04"
],
"name": "git_cl upload"
},
{
"cmd": [
"RECIPE_PACKAGE_REPO[depot_tools]/git_cl.py",
"issue"
],
"name": "git_cl issue",
"stdout": "/path/to/tmp/"
},
{ {
"cmd": [ "cmd": [
"RECIPE_PACKAGE_REPO[depot_tools]/git_cl.py", "RECIPE_PACKAGE_REPO[depot_tools]/git_cl.py",
......
# -*- coding: utf-8 -*-
# Copyright 2016 The Chromium Authors. All rights reserved. # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
...@@ -14,6 +15,8 @@ DEPS = [ ...@@ -14,6 +15,8 @@ DEPS = [
def RunSteps(api): def RunSteps(api):
api.git_cl.upload(u"Do the thing foobar\nNow with emoji: 😄")
api.git_cl.issue()
result = api.git_cl.get_description( result = api.git_cl.get_description(
patch='https://code.review/123', codereview='rietveld', suffix='build') patch='https://code.review/123', codereview='rietveld', suffix='build')
api.git_cl.set_description( api.git_cl.set_description(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment