Patchwork revset: simplify fullreposet.__and__ to call sort() with boolean flag

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 10, 2015, 3:53 p.m.
Message ID <22a0ea93d4466091a2d5.1420905199@mimosa>
Download mbox | patch
Permalink /patch/7426/
State Accepted
Commit 4982fade9733014b070d3b6556ca1dc8fbba9c19
Headers show

Comments

Yuya Nishihara - Jan. 10, 2015, 3:53 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1420893402 -32400
#      Sat Jan 10 21:36:42 2015 +0900
# Node ID 22a0ea93d4466091a2d52b35ec555818249f047d
# Parent  678f53865c6860a950392691814766957ee89316
revset: simplify fullreposet.__and__ to call sort() with boolean flag

Note that sort() takes a boolean flag, so other.sort(reverse) was wrong.
It just worked fine because there is a top-level function, reverse().
Matt Mackall - Jan. 13, 2015, 11:41 p.m.
On Sun, 2015-01-11 at 00:53 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1420893402 -32400
> #      Sat Jan 10 21:36:42 2015 +0900
> # Node ID 22a0ea93d4466091a2d52b35ec555818249f047d
> # Parent  678f53865c6860a950392691814766957ee89316
> revset: simplify fullreposet.__and__ to call sort() with boolean flag

Queued for default, thanks.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -3102,10 +3102,7 @@  class fullreposet(_spanset):
             # object.
             other = baseset(other - self._hiddenrevs)
 
-        if self.isascending():
-            other.sort()
-        else:
-            other.sort(reverse)
+        other.sort(reverse=self.isdescending())
         return other
 
 # tell hggettext to extract docstrings from these functions: