Commit 51bdf8c8 authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

Reland "git cl: delete no longer used Rietveld methods."

This is a reland of 38d36a61
but now
 $ git cl status
 $ git cl archive
actually work.

Original change's description:
> git cl: delete no longer used Rietveld methods.
>
> R=ehmaldonado
>
> Bug: 770408
> Change-Id: I4dc034839180a7587ee368793547c5b74c2572f6
> Reviewed-on: https://chromium-review.googlesource.com/c/1279139
> Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>

Bug: 770408, 895784
Change-Id: Id1dbf31dc19d693f1c4636c9558e1ac99fe6a77b
Reviewed-on: https://chromium-review.googlesource.com/c/1287245
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
parent 4ac892e4
......@@ -1951,7 +1951,8 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase):
return self._rietveld_server
def EnsureAuthenticated(self, force, refresh=False):
raise NotImplementedError
# No checks for Rietveld because we are deprecating Rietveld.
pass
def EnsureCanUploadPatchset(self, force):
# No checks for Rietveld because we are deprecating Rietveld.
......@@ -1973,88 +1974,33 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase):
raise NotImplementedError()
def GetIssueOwner(self):
return (self.GetIssueProperties() or {}).get('owner_email')
raise NotImplementedError()
def GetReviewers(self):
return (self.GetIssueProperties() or {}).get('reviewers')
raise NotImplementedError()
def AddComment(self, message, publish=None):
return self.RpcServer().add_comment(self.GetIssue(), message)
raise NotImplementedError()
def GetCommentsSummary(self, _readable=True):
summary = []
for message in self.GetIssueProperties().get('messages', []):
date = datetime.datetime.strptime(message['date'], '%Y-%m-%d %H:%M:%S.%f')
summary.append(_CommentSummary(
date=date,
disapproval=bool(message['disapproval']),
approval=bool(message['approval']),
sender=message['sender'],
message=message['text'],
))
return summary
def GetCommentsSummary(self, readable=True):
raise NotImplementedError()
def GetStatus(self):
"""Applies a rough heuristic to give a simple summary of an issue's review
or CQ status, assuming adherence to a common workflow.
Returns None if no issue for this branch, or one of the following keywords:
* 'error' - error from review tool (including deleted issues)
* 'unsent' - not sent for review
* 'waiting' - waiting for review
* 'reply' - waiting for owner to reply to review
* 'not lgtm' - Code-Review label has been set negatively
* 'lgtm' - LGTM from at least one approved reviewer
* 'commit' - in the commit queue
* 'closed' - closed
"""
if not self.GetIssue():
return None
try:
props = self.GetIssueProperties()
except urllib2.HTTPError:
return 'error'
if props.get('closed'):
# Issue is closed.
return 'closed'
if props.get('commit') and not props.get('cq_dry_run', False):
# Issue is in the commit queue.
return 'commit'
messages = props.get('messages') or []
if not messages:
# No message was sent.
return 'unsent'
if get_approving_reviewers(props):
return 'lgtm'
elif get_approving_reviewers(props, disapproval=True):
return 'not lgtm'
# Skip CQ messages that don't require owner's action.
while messages and messages[-1]['sender'] == COMMIT_BOT_EMAIL:
if 'Dry run:' in messages[-1]['text']:
messages.pop()
elif 'The CQ bit was unchecked' in messages[-1]['text']:
# This message always follows prior messages from CQ,
# so skip this too.
messages.pop()
else:
# This is probably a CQ messages warranting user attention.
break
if messages[-1]['sender'] != props.get('owner_email'):
# Non-LGTM reply from non-owner and not CQ bot.
return 'reply'
return 'waiting'
print(
'WARNING! Rietveld is no longer supported.\n'
'\n'
'If you have old branches in your checkout, please archive/delete them.\n'
' $ git cl archive --help\n'
'\n'
'See also PSA https://groups.google.com/a/chromium.org/'
'forum/#!topic/infra-dev/2DIVzM2wseo\n')
return 'rietveld-not-supported'
def UpdateDescriptionRemote(self, description, force=False):
self.RpcServer().update_description(self.GetIssue(), description)
raise NotImplementedError()
def CloseIssue(self):
return self.RpcServer().close_issue(self.GetIssue())
raise NotImplementedError()
def SetFlag(self, flag, value):
return self.SetFlags({flag: value})
......@@ -4321,7 +4267,7 @@ def CMDarchive(parser, args):
proposal = [(cl.GetBranch(),
'git-cl-archived-%s-%s' % (cl.GetIssue(), cl.GetBranch()))
for cl, status in statuses
if status == 'closed']
if status in ('closed', 'rietveld-not-supported')]
proposal.sort()
if not proposal:
......
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