Commit 6859823b authored by phajdan.jr's avatar phajdan.jr Committed by Commit bot

git cl set-commit: allow forcing code review system

Also default to latest patchset if no other one is specified locally.

BUG=600945

Review-Url: https://codereview.chromium.org/2230883002
parent eb0dc31a
...@@ -1731,21 +1731,18 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase): ...@@ -1731,21 +1731,18 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase):
def SetFlags(self, flags): def SetFlags(self, flags):
"""Sets flags on this CL/patchset in Rietveld. """Sets flags on this CL/patchset in Rietveld.
The latest patchset in Rietveld must be the same as latest known locally.
""" """
if not self.GetPatchset(): patchset = self.GetPatchset() or self.GetMostRecentPatchset()
DieWithError('The patchset needs to match. Send another patchset.')
try: try:
return self.RpcServer().set_flags( return self.RpcServer().set_flags(
self.GetIssue(), self.GetPatchset(), flags) self.GetIssue(), patchset, flags)
except urllib2.HTTPError as e: except urllib2.HTTPError as e:
if e.code == 404: if e.code == 404:
DieWithError('The issue %s doesn\'t exist.' % self.GetIssue()) DieWithError('The issue %s doesn\'t exist.' % self.GetIssue())
if e.code == 403: if e.code == 403:
DieWithError( DieWithError(
('Access denied to issue %s. Maybe the patchset %s doesn\'t ' ('Access denied to issue %s. Maybe the patchset %s doesn\'t '
'match?') % (self.GetIssue(), self.GetPatchset())) 'match?') % (self.GetIssue(), patchset))
raise raise
def RpcServer(self): def RpcServer(self):
...@@ -4725,7 +4722,9 @@ def CMDset_commit(parser, args): ...@@ -4725,7 +4722,9 @@ def CMDset_commit(parser, args):
parser.add_option('-c', '--clear', action='store_true', parser.add_option('-c', '--clear', action='store_true',
help='stop CQ run, if any') help='stop CQ run, if any')
auth.add_auth_options(parser) auth.add_auth_options(parser)
_add_codereview_select_options(parser)
options, args = parser.parse_args(args) options, args = parser.parse_args(args)
_process_codereview_select_options(parser, options)
auth_config = auth.extract_auth_config_from_options(options) auth_config = auth.extract_auth_config_from_options(options)
if args: if args:
parser.error('Unrecognized args: %s' % ' '.join(args)) parser.error('Unrecognized args: %s' % ' '.join(args))
......
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