Commit 8630bb11 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by LUCI CQ

Revert "Add option to git cl st to sort by committer date"

This reverts commit 9ca89ac1.

Reason for revert: Breaks git cl st

Original change's description:
> Add option to git cl st to sort by committer date
>
> Some developers want to see the branches with recent commits first.
> This CL adds the option --dateorder to git cl st which sorts branches
> by the committer date of the most recent branch.
>
> Change-Id: Ibdf3fc35ea784521a3e99b374535f822bb83a55e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2521573
> Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Reviewed-by: Dirk Pranke <dpranke@google.com>

TBR=dpranke@google.com,sigurds@chromium.org,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

Tbr: dpranke@google.com
Change-Id: I3ed44d42b8383691682442567e3151508126fbd5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2532834
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Auto-Submit: Sigurd Schneider <sigurds@chromium.org>
parent 9ca89ac1
...@@ -939,11 +939,7 @@ class Changelist(object): ...@@ -939,11 +939,7 @@ class Changelist(object):
with great care. with great care.
""" """
def __init__(self, def __init__(self, branchref=None, issue=None, codereview_host=None):
branchref=None,
issue=None,
codereview_host=None,
commit_date=None):
"""Create a new ChangeList instance. """Create a new ChangeList instance.
**kwargs will be passed directly to Gerrit implementation. **kwargs will be passed directly to Gerrit implementation.
...@@ -960,7 +956,6 @@ class Changelist(object): ...@@ -960,7 +956,6 @@ class Changelist(object):
self.branch = scm.GIT.ShortBranchName(self.branchref) self.branch = scm.GIT.ShortBranchName(self.branchref)
else: else:
self.branch = None self.branch = None
self.commit_date = commit_date
self.upstream_branch = None self.upstream_branch = None
self.lookedup_issue = False self.lookedup_issue = False
self.issue = issue or None self.issue = issue or None
...@@ -999,10 +994,6 @@ class Changelist(object): ...@@ -999,10 +994,6 @@ class Changelist(object):
"""Extends the list of users to cc on this CL based on the changed files.""" """Extends the list of users to cc on this CL based on the changed files."""
self.more_cc.extend(more_cc) self.more_cc.extend(more_cc)
def GetCommitDate(self):
"""Returns the commit date as provided in the constructor"""
return self.commit_date
def GetBranch(self): def GetBranch(self):
"""Returns the short branch name, e.g. 'main'.""" """Returns the short branch name, e.g. 'main'."""
if not self.branch: if not self.branch:
...@@ -2664,10 +2655,7 @@ class ChangeDescription(object): ...@@ -2664,10 +2655,7 @@ class ChangeDescription(object):
bug_regexp = re.compile(self.BUG_LINE) bug_regexp = re.compile(self.BUG_LINE)
fixed_regexp = re.compile(self.FIXED_LINE) fixed_regexp = re.compile(self.FIXED_LINE)
prefix = settings.GetBugPrefix() prefix = settings.GetBugPrefix()
has_issue = lambda l: bug_regexp.match(l) or fixed_regexp.match(l)
def has_issue(l):
return bug_regexp.match(l) or fixed_regexp.match(l)
if not any((has_issue(line) for line in self._description_lines)): if not any((has_issue(line) for line in self._description_lines)):
self.append_footer('Bug: %s' % prefix) self.append_footer('Bug: %s' % prefix)
...@@ -3509,10 +3497,6 @@ def CMDstatus(parser, args): ...@@ -3509,10 +3497,6 @@ def CMDstatus(parser, args):
'-i', '--issue', type=int, '-i', '--issue', type=int,
help='Operate on this issue instead of the current branch\'s implicit ' help='Operate on this issue instead of the current branch\'s implicit '
'issue. Requires --field to be set.') 'issue. Requires --field to be set.')
parser.add_option('-d',
'--dateorder',
action='store_true',
help='Order branches by committer date.')
options, args = parser.parse_args(args) options, args = parser.parse_args(args)
if args: if args:
parser.error('Unsupported args: %s' % args) parser.error('Unsupported args: %s' % args)
...@@ -3541,17 +3525,14 @@ def CMDstatus(parser, args): ...@@ -3541,17 +3525,14 @@ def CMDstatus(parser, args):
print(url) print(url)
return 0 return 0
branches = RunGit([ branches = RunGit(['for-each-ref', '--format=%(refname)', 'refs/heads'])
'for-each-ref', '--format=%(refname) %(committerdate:unix)', 'refs/heads'
])
if not branches: if not branches:
print('No local branch found.') print('No local branch found.')
return 0 return 0
changes = [ changes = [
Changelist(branchref=b, commit_date=ct) Changelist(branchref=b)
for b, ct in map(lambda line: line.split(' '), branches.splitlines()) for b in branches.splitlines()]
]
print('Branches associated with reviews:') print('Branches associated with reviews:')
output = get_cl_statuses(changes, output = get_cl_statuses(changes,
fine_grained=not options.fast, fine_grained=not options.fast,
...@@ -3577,13 +3558,7 @@ def CMDstatus(parser, args): ...@@ -3577,13 +3558,7 @@ def CMDstatus(parser, args):
branch_statuses = {} branch_statuses = {}
alignment = max(5, max(len(FormatBranchName(c.GetBranch())) for c in changes)) alignment = max(5, max(len(FormatBranchName(c.GetBranch())) for c in changes))
if options.committerdate: for cl in sorted(changes, key=lambda c: c.GetBranch()):
sorted_changes = sorted(changes,
key=lambda c: c.GetCommitDate(),
reverse=True)
else:
sorted_changes = sorted(changes, key=lambda c: c.GetBranch())
for cl in sorted_changes:
branch = cl.GetBranch() branch = cl.GetBranch()
while branch not in branch_statuses: while branch not in branch_statuses:
c, status = next(output) c, status = next(output)
...@@ -5224,7 +5199,6 @@ def CMDlol(parser, args): ...@@ -5224,7 +5199,6 @@ def CMDlol(parser, args):
class OptionParser(optparse.OptionParser): class OptionParser(optparse.OptionParser):
"""Creates the option parse and add --verbose support.""" """Creates the option parse and add --verbose support."""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
optparse.OptionParser.__init__( optparse.OptionParser.__init__(
self, *args, prog='git cl', version=__version__, **kwargs) self, *args, prog='git cl', version=__version__, **kwargs)
......
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