[PATCH] revset: simplify fullreposet.__and__ to call sort() with boolean flag

Yuya Nishihara yuya at tcha.org
Sat Jan 10 15:53:19 UTC 2015


# HG changeset patch
# User Yuya Nishihara <yuya at 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().

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:


More information about the Mercurial-devel mailing list