|
@@ -905,7 +905,8 @@ class TestGitCl(TestCase):
|
|
title=None, notify=False,
|
|
title=None, notify=False,
|
|
post_amend_description=None, issue=None, cc=None,
|
|
post_amend_description=None, issue=None, cc=None,
|
|
custom_cl_base=None, tbr=None,
|
|
custom_cl_base=None, tbr=None,
|
|
- short_hostname='chromium'):
|
|
|
|
|
|
+ short_hostname='chromium',
|
|
|
|
+ labels=None):
|
|
if post_amend_description is None:
|
|
if post_amend_description is None:
|
|
post_amend_description = description
|
|
post_amend_description = description
|
|
cc = cc or []
|
|
cc = cc or []
|
|
@@ -1048,6 +1049,10 @@ class TestGitCl(TestCase):
|
|
if c in cc:
|
|
if c in cc:
|
|
cc.remove(c)
|
|
cc.remove(c)
|
|
|
|
|
|
|
|
+ if not tbr:
|
|
|
|
+ for k, v in sorted((labels or {}).items()):
|
|
|
|
+ ref_suffix += ',l=%s+%d' % (k, v)
|
|
|
|
+
|
|
calls.append((
|
|
calls.append((
|
|
(['git', 'push',
|
|
(['git', 'push',
|
|
'https://%s.googlesource.com/my/repo' % short_hostname,
|
|
'https://%s.googlesource.com/my/repo' % short_hostname,
|
|
@@ -1130,7 +1135,8 @@ class TestGitCl(TestCase):
|
|
other_cl_owner=None,
|
|
other_cl_owner=None,
|
|
custom_cl_base=None,
|
|
custom_cl_base=None,
|
|
tbr=None,
|
|
tbr=None,
|
|
- short_hostname='chromium'):
|
|
|
|
|
|
+ short_hostname='chromium',
|
|
|
|
+ labels=None):
|
|
"""Generic gerrit upload test framework."""
|
|
"""Generic gerrit upload test framework."""
|
|
if squash_mode is None:
|
|
if squash_mode is None:
|
|
if '--no-squash' in upload_args:
|
|
if '--no-squash' in upload_args:
|
|
@@ -1172,7 +1178,8 @@ class TestGitCl(TestCase):
|
|
post_amend_description=post_amend_description,
|
|
post_amend_description=post_amend_description,
|
|
issue=issue, cc=cc,
|
|
issue=issue, cc=cc,
|
|
custom_cl_base=custom_cl_base, tbr=tbr,
|
|
custom_cl_base=custom_cl_base, tbr=tbr,
|
|
- short_hostname=short_hostname)
|
|
|
|
|
|
+ short_hostname=short_hostname,
|
|
|
|
+ labels=labels)
|
|
# Uncomment when debugging.
|
|
# Uncomment when debugging.
|
|
# print '\n'.join(map(lambda x: '%2i: %s' % x, enumerate(self.calls)))
|
|
# print '\n'.join(map(lambda x: '%2i: %s' % x, enumerate(self.calls)))
|
|
git_cl.main(['upload'] + upload_args)
|
|
git_cl.main(['upload'] + upload_args)
|
|
@@ -1256,6 +1263,15 @@ class TestGitCl(TestCase):
|
|
squash=True,
|
|
squash=True,
|
|
expected_upstream_ref='origin/master')
|
|
expected_upstream_ref='origin/master')
|
|
|
|
|
|
|
|
+ def test_gerrit_upload_squash_first_with_labels(self):
|
|
|
|
+ self._run_gerrit_upload_test(
|
|
|
|
+ ['--squash', '--cq-dry-run', '--enable-auto-submit'],
|
|
|
|
+ 'desc\nBUG=\n\nChange-Id: 123456789',
|
|
|
|
+ [],
|
|
|
|
+ squash=True,
|
|
|
|
+ expected_upstream_ref='origin/master',
|
|
|
|
+ labels={'Commit-Queue': 1, 'Auto-Submit': 1})
|
|
|
|
+
|
|
def test_gerrit_upload_squash_first_against_rev(self):
|
|
def test_gerrit_upload_squash_first_against_rev(self):
|
|
custom_cl_base = 'custom_cl_base_rev_or_branch'
|
|
custom_cl_base = 'custom_cl_base_rev_or_branch'
|
|
self._run_gerrit_upload_test(
|
|
self._run_gerrit_upload_test(
|