[PATCH 1 of 3 V4] revset: record if a set is in topographical order

Yuya Nishihara yuya at tcha.org
Wed Jun 15 09:23:12 EDT 2016


On Tue, 14 Jun 2016 17:06:44 +0100, Martijn Pieters wrote:
> On 14 June 2016 at 16:37, Yuya Nishihara <yuya at tcha.org> wrote:
> >> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> >> --- a/mercurial/cmdutil.py
> >> +++ b/mercurial/cmdutil.py
> >> @@ -2147,7 +2147,7 @@
> >>      if opts.get('rev'):
> >>          # User-specified revs might be unsorted, but don't sort before
> >>          # _makelogrevset because it might depend on the order of revs
> >> -        if not revs.isdescending():
> >> +        if not (revs.isdescending() or revs.istopo()):
> >>              revs.sort(reverse=True)
> >>      if expr:
> >>          # Revset matchers often operate faster on revisions in changelog  
> >
> > You'll need to stop sorting in "if expr" after my patches are landed. I'm
> > fixing the issue of unstable ordering.  
> 
> Not sure I follow you here; this line prevents hg log -G from sorting
> an already sorted revset; you don't want to resort a topographical
> sort!

We don't want to cancel the topo sorting even if "-k" is specified, for
example. But we can't simply remove revs.sort(reverse=True) now because there
is a bug. See c407583cf5f6 for details.

https://selenic.com/repo/hg/file/tip/mercurial/cmdutil.py#l2161


More information about the Mercurial-devel mailing list