Patchwork [2,of,3,diffset-extra] revset: use _diffset in _lazysetiteratormixin.__sub__

login
register
mail settings
Submitter Gregory Szorc
Date Sept. 8, 2014, 10 p.m.
Message ID <3a75a1f6937b15a6edc5.1410213651@gps-mbp.local>
Download mbox | patch
Permalink /patch/5734/
State Deferred
Headers show

Comments

Gregory Szorc - Sept. 8, 2014, 10 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1410200422 25200
#      Mon Sep 08 11:20:22 2014 -0700
# Node ID 3a75a1f6937b15a6edc5e7a5c838c8d4cdf9dc73
# Parent  b590210d167f2a0f6445f58427d70af7cde96be5
revset: use _diffset in _lazysetiteratormixin.__sub__

This patch results in no statistically significant changes in the revset
benchmarks on a clone of the Firefox repository.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2517,12 +2517,15 @@  class _lazysetiteratormixin(_orderedsetm
                 kwargs['ascending'] = False
         return _addset(self, other, **kwargs)
 
     def __sub__(self, other):
-        filterfunc = lambda r: r not in other
+        kwargs = {}
         if self._ascending is not None:
-            return orderedlazyset(self, filterfunc, ascending=self._ascending)
-        return lazyset(self, filterfunc)
+            if self.isascending() and other.isascending():
+                kwargs['ascending'] = True
+            if self.isdescending() and other.isdescending():
+                kwargs['ascending'] = False
+        return _diffset(self, other, **kwargs)
 
     def __iter__(self):
         if self._genlist:
             return iter(self._genlist)