Patchwork revset: remove explicit sort() from unstable()

login
register
mail settings
Submitter Yuya Nishihara
Date April 15, 2020, 1:47 p.m.
Message ID <f9735a7cf54beb15dd25.1586958453@mimosa>
Download mbox | patch
Permalink /patch/46125/
State Accepted
Headers show

Comments

Yuya Nishihara - April 15, 2020, 1:47 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1586946261 -32400
#      Wed Apr 15 19:24:21 2020 +0900
# Node ID f9735a7cf54beb15dd252042df17cb620556b103
# Parent  f0d88d20654ba1bc6a3c42c6dd06cc366142879d
revset: remove explicit sort() from unstable()

The instability should be dealt with by baseset.__init__(), and the returned
smartset is ordered by 'subset &' anyway.
Augie Fackler - April 15, 2020, 4:31 p.m.
queued, thanks

> On Apr 15, 2020, at 09:47, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1586946261 -32400
> #      Wed Apr 15 19:24:21 2020 +0900
> # Node ID f9735a7cf54beb15dd252042df17cb620556b103
> # Parent  f0d88d20654ba1bc6a3c42c6dd06cc366142879d
> revset: remove explicit sort() from unstable()
> 
> The instability should be dealt with by baseset.__init__(), and the returned
> smartset is ordered by 'subset &' anyway.
> 
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -2518,9 +2518,7 @@ def unstable(repo, subset, x):
>     _unstable.update(obsmod.getrevs(repo, b'orphan'))
>     _unstable.update(obsmod.getrevs(repo, b'phasedivergent'))
>     _unstable.update(obsmod.getrevs(repo, b'contentdivergent'))
> -    _unstable = baseset(_unstable)
> -    _unstable.sort()  # set is non-ordered, enforce order
> -    return subset & _unstable
> +    return subset & baseset(_unstable)
> 
> 
> @predicate(b'user(string)', safe=True, weight=10)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2518,9 +2518,7 @@  def unstable(repo, subset, x):
     _unstable.update(obsmod.getrevs(repo, b'orphan'))
     _unstable.update(obsmod.getrevs(repo, b'phasedivergent'))
     _unstable.update(obsmod.getrevs(repo, b'contentdivergent'))
-    _unstable = baseset(_unstable)
-    _unstable.sort()  # set is non-ordered, enforce order
-    return subset & _unstable
+    return subset & baseset(_unstable)
 
 
 @predicate(b'user(string)', safe=True, weight=10)