Patchwork [2,of,2] log: drop outdated optimization to walk revisions in reverse order

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 22, 2016, 2:24 p.m.
Message ID <ffd93984937821bf449e.1474554288@mimosa>
Download mbox | patch
Permalink /patch/16757/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 22, 2016, 2:24 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1474545564 -32400
#      Thu Sep 22 20:59:24 2016 +0900
# Node ID ffd93984937821bf449e2596acdb15a2c4ee88af
# Parent  63cfb37603c39abe9e7ef58462c39dd1bb83c2df
log: drop outdated optimization to walk revisions in reverse order

Since revset is computed lazily, there would be no (or little) benefit to
reverse 'revs' temporarily.
Pierre-Yves David - Sept. 23, 2016, 10:16 a.m.
On 09/22/2016 04:24 PM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1474545564 -32400
> #      Thu Sep 22 20:59:24 2016 +0900
> # Node ID ffd93984937821bf449e2596acdb15a2c4ee88af
> # Parent  63cfb37603c39abe9e7ef58462c39dd1bb83c2df
> log: drop outdated optimization to walk revisions in reverse order
>
> Since revset is computed lazily, there would be no (or little) benefit to
> reverse 'revs' temporarily.

I've pushed these two. Thanks.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2152,12 +2152,8 @@  def getgraphlogrevs(repo, pats, opts):
         if not (revs.isdescending() or revs.istopo()):
             revs.sort(reverse=True)
     if expr:
-        # Revset matchers often operate faster on revisions in changelog
-        # order, because most filters deal with the changelog.
-        revs.reverse()
         matcher = revset.match(repo.ui, expr, order=revset.followorder)
         revs = matcher(repo, revs)
-        revs.reverse()
     if limit is not None:
         limitedrevs = []
         for idx, rev in enumerate(revs):
@@ -2182,14 +2178,8 @@  def getlogrevs(repo, pats, opts):
         return revset.baseset([]), None, None
     expr, filematcher = _makelogrevset(repo, pats, opts, revs)
     if expr:
-        # Revset matchers often operate faster on revisions in changelog
-        # order, because most filters deal with the changelog.
-        if not opts.get('rev'):
-            revs.reverse()
         matcher = revset.match(repo.ui, expr, order=revset.followorder)
         revs = matcher(repo, revs)
-        if not opts.get('rev'):
-            revs.reverse()
     if limit is not None:
         limitedrevs = []
         for idx, r in enumerate(revs):