mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 02:31:29 +00:00
Fix setbotcommit comment on ambiguous revision
Add revision number option to gerrit_client.py setbotcommit command. Add an explicit revision number to a setbotcommit call in the update_files method. After creating a new patch-set in the release recipe and verifying it was created we are adding a comment which could be applied to the previous patch. Setting `Bot-Commit+1` relied on the default 'current' revision which may be stale in some Gerrit replicas. This CL applies the fix suggested in 412739202 Bug: 414681998 Change-Id: I1d380e221864bcf1183c77fa58be4ede9a787ef1 Recipe-Nontrivial-Roll: build_internal Recipe-Nontrivial-Roll: chrome_release Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6718447 Reviewed-by: Alex Kravchuk <alexanderkr@google.com> Reviewed-by: Scott Lee <ddoman@chromium.org>
This commit is contained in:
@@ -383,9 +383,18 @@ def CMDgetcommitincludedin(parser, args):
|
|||||||
def CMDsetbotcommit(parser, args):
|
def CMDsetbotcommit(parser, args):
|
||||||
"""Sets bot-commit+1 to a bot generated change."""
|
"""Sets bot-commit+1 to a bot generated change."""
|
||||||
parser.add_option('-c', '--change', type=int, help='change number')
|
parser.add_option('-c', '--change', type=int, help='change number')
|
||||||
|
parser.add_option(
|
||||||
|
'-r',
|
||||||
|
'--revision',
|
||||||
|
type=str,
|
||||||
|
default='current',
|
||||||
|
help='revision ID. See '
|
||||||
|
'https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id ' # pylint: disable=line-too-long
|
||||||
|
'for acceptable format')
|
||||||
(opt, args) = parser.parse_args(args)
|
(opt, args) = parser.parse_args(args)
|
||||||
result = gerrit_util.SetReview(urllib.parse.urlparse(opt.host).netloc,
|
result = gerrit_util.SetReview(urllib.parse.urlparse(opt.host).netloc,
|
||||||
opt.change,
|
opt.change,
|
||||||
|
opt.revision,
|
||||||
labels={'Bot-Commit': 1},
|
labels={'Bot-Commit': 1},
|
||||||
ready=True)
|
ready=True)
|
||||||
logging.info(result)
|
logging.info(result)
|
||||||
|
|||||||
@@ -558,13 +558,16 @@ class GerritApi(recipe_api.RecipeApi):
|
|||||||
publish_command.append('--verbose')
|
publish_command.append('--verbose')
|
||||||
self('publish edit', publish_command)
|
self('publish edit', publish_command)
|
||||||
|
|
||||||
|
NEW_PATCHSET_REVISION_NUMBER = 2
|
||||||
# Make sure the new patchset is propagated to Gerrit backend.
|
# Make sure the new patchset is propagated to Gerrit backend.
|
||||||
with self.m.step.nest('verify the patchset exists on CL %d' % change):
|
with self.m.step.nest('verify the patchset exists on CL %d' % change):
|
||||||
retries = 0
|
retries = 0
|
||||||
max_retries = 2
|
max_retries = 2
|
||||||
while retries <= max_retries:
|
while retries <= max_retries:
|
||||||
try:
|
try:
|
||||||
if self.get_revision_info(host, change, 2):
|
if self.get_revision_info(host,
|
||||||
|
change,
|
||||||
|
patchset=NEW_PATCHSET_REVISION_NUMBER):
|
||||||
break
|
break
|
||||||
except self.m.step.InfraFailure:
|
except self.m.step.InfraFailure:
|
||||||
if retries == max_retries: # pragma: no cover
|
if retries == max_retries: # pragma: no cover
|
||||||
@@ -580,6 +583,8 @@ class GerritApi(recipe_api.RecipeApi):
|
|||||||
host,
|
host,
|
||||||
'--change',
|
'--change',
|
||||||
change,
|
change,
|
||||||
|
'--revision',
|
||||||
|
NEW_PATCHSET_REVISION_NUMBER,
|
||||||
]
|
]
|
||||||
if verbose:
|
if verbose:
|
||||||
set_bot_commit_command.append('--verbose')
|
set_bot_commit_command.append('--verbose')
|
||||||
|
|||||||
@@ -384,6 +384,8 @@
|
|||||||
"https://chromium-review.googlesource.com",
|
"https://chromium-review.googlesource.com",
|
||||||
"--change",
|
"--change",
|
||||||
"91827",
|
"91827",
|
||||||
|
"--revision",
|
||||||
|
"2",
|
||||||
"--verbose"
|
"--verbose"
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
|
|||||||
Reference in New Issue
Block a user