[PATCH 1 of 2] baseset: keep the input set around

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Aug 21 22:58:41 UTC 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1440116396 25200
#      Thu Aug 20 17:19:56 2015 -0700
# Node ID 76e8706080029160e4b71b043ac20b2760516eab
# Parent  d9d3d49c4cf77049d12920980e91bf8e4a4ecda2
baseset: keep the input set around

Baseset needs a list to operate, but will convert that list back to a set for
membership testing. It seems a bit silly to convert the set into a list to
convert is back afterward.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2964,10 +2964,12 @@ class baseset(abstractsmartset):
 
     Every method in this class should be implemented by any smartset class.
     """
     def __init__(self, data=()):
         if not isinstance(data, list):
+            if isinstance(data, set):
+                self._set = data
             data = list(data)
         self._list = data
         self._ascending = None
 
     @util.propertycache


More information about the Mercurial-devel mailing list