mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Support --target_branch=refs/meta/config branch
This simplifies the administration of repositories which is currently done via the Gerrit UI instead of the CLI. Bug: None Change-Id: I0af3d77fb611e0c89dc455a5a215129b5c51c5ea Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5472843 Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Auto-Submit: Alexander Schulze <alexschulze@chromium.org>
This commit is contained in:
committed by
LUCI CQ
parent
6ba67afd6f
commit
b0e2e28a95
@@ -1320,7 +1320,8 @@ class Changelist(object):
|
||||
|
||||
self.branchref = branchref
|
||||
if self.branchref:
|
||||
assert branchref.startswith(('refs/heads/', 'refs/branch-heads/'))
|
||||
assert (branchref.startswith(('refs/heads/', 'refs/branch-heads/'))
|
||||
or branchref == 'refs/meta/config')
|
||||
self.branch = scm.GIT.ShortBranchName(self.branchref)
|
||||
else:
|
||||
self.branch = None
|
||||
|
||||
@@ -260,6 +260,30 @@ class TestGitClBasic(unittest.TestCase):
|
||||
self.assertFalse(hasattr(options, 'force'))
|
||||
self.assertFalse(hasattr(options, 'edit_description'))
|
||||
|
||||
def test_upload_to_meta_config_branch_no_retry(self):
|
||||
m = mock.patch('git_cl.Changelist._CMDUploadChange',
|
||||
side_effect=[git_cl.GitPushError(), None]).start()
|
||||
mock.patch('git_cl.Changelist.GetRemoteBranch',
|
||||
return_value=('foo', 'bar')).start()
|
||||
mock.patch('git_cl.Changelist.GetGerritProject',
|
||||
return_value='foo').start()
|
||||
mock.patch('git_cl.gerrit_util.GetProjectHead',
|
||||
return_value='refs/heads/main').start()
|
||||
|
||||
cl = git_cl.Changelist()
|
||||
options = optparse.Values()
|
||||
options.target_branch = 'refs/meta/config'
|
||||
with self.assertRaises(SystemExitMock):
|
||||
cl.CMDUploadChange(options, [], 'foo',
|
||||
git_cl.ChangeDescription('bar'))
|
||||
|
||||
# ensure upload is called once
|
||||
self.assertEqual(len(m.mock_calls), 1)
|
||||
sys.exit.assert_called_once_with(1)
|
||||
# option not set as retry didn't happen
|
||||
self.assertFalse(hasattr(options, 'force'))
|
||||
self.assertFalse(hasattr(options, 'edit_description'))
|
||||
|
||||
def test_upload_to_old_default_still_active(self):
|
||||
m = mock.patch('git_cl.Changelist._CMDUploadChange',
|
||||
side_effect=[git_cl.GitPushError(), None]).start()
|
||||
|
||||
Reference in New Issue
Block a user