Commit c7e84d04 authored by Aaron Gable's avatar Aaron Gable Committed by Commit Bot

git-drover: TBR appropriate reviewers

When uploading to either Rietveld or Gerrit, this will
cause git-cl to add the appropriate reviewers to the
cherry-pick review, so they're aware the change is being
copied to the release branch.

When uploading to Gerrit, this will also cause git-cl to
set the Code-Review+1 bit, allowing the CL to be landed

R=tandrii@chromium.org

Bug: 714720
Change-Id: Ie04e2657a91e4345796ac2200c0115fb18e460a1
Reviewed-on: https://chromium-review.googlesource.com/486961
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
parent 895235fc
......@@ -9,6 +9,7 @@ import cPickle
import functools
import logging
import os
import re
import shutil
import subprocess
import sys
......@@ -274,7 +275,9 @@ class _Drover(object):
return True
self._run_git_command(['reset', '--hard'])
self._run_git_command(['cl', 'upload'],
author = self._run_git_command(['log', '-1', '--format=%ae']).strip()
self._run_git_command(['cl', 'upload', '--tbrs', author],
error_message='Upload failed',
interactive=True)
......@@ -294,6 +297,9 @@ class _Drover(object):
interaction. If false, the command will be provided with no input and
the output is captured.
Returns:
stdout as a string, or stdout interleaved with stderr if self._verbose
Raises:
Error: The command failed to complete successfully.
"""
......@@ -321,6 +327,9 @@ class _Drover(object):
args: A list of strings containing the args to pass to git.
stdin: A string to provide on stdin.
Returns:
stdout as a string, or stdout interleaved with stderr if self._verbose
Raises:
Error: The command failed to complete successfully.
"""
......
......@@ -42,6 +42,7 @@ class GitDroverTest(auto_stub.TestCase):
self._commands = []
self._input = []
self._fail_on_command = None
self._reviewers = ''
self.REPO_CHECK_COMMANDS = [
(['git', '--help'], self._parent_repo),
......@@ -61,7 +62,9 @@ class GitDroverTest(auto_stub.TestCase):
]
self.UPLOAD_COMMANDS = [
(['git', 'reset', '--hard'], self._target_repo),
(['git', 'cl', 'upload'], self._target_repo),
(['git', 'log', '-1', '--format=%ae'], self._target_repo),
(['git', 'cl', 'upload', '--tbrs', 'author@domain.org'],
self._target_repo),
]
self.LAND_COMMAND = [
(['git', 'cl', 'land', '--bypass-hooks'], self._target_repo),
......@@ -113,6 +116,8 @@ class GitDroverTest(auto_stub.TestCase):
return os.path.join(self._parent_repo, '.git')
if args == ['git', 'status', '--porcelain']:
return ' D foo\nUU baz\n D bar\n'
if args == ['git', 'log', '-1', '--format=%ae']:
return 'author@domain.org'
return ''
def _Popen(self, args, shell=False, cwd=None, stdin=None, stdout=None,
......@@ -293,7 +298,7 @@ class GitDroverTest(auto_stub.TestCase):
def testFailOnUpload(self):
self._input = ['y']
self._fail_on_command = 12
self._fail_on_command = 13
self.assertRaises(git_drover.Error, git_drover.cherry_pick_change, 'branch',
'cl', self._parent_repo, False)
self.assertEqual(self.REPO_CHECK_COMMANDS + self.LOCAL_REPO_COMMANDS +
......
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