Patchwork [2,of,2] revset: added __add__ method to baseset class

login
register
mail settings
Submitter Lucas Moscovicz
Date Feb. 6, 2014, 7:42 p.m.
Message ID <3ab8d986e51808fc3e56.1391715743@dev1037.prn2.facebook.com>
Download mbox | patch
Permalink /patch/3502/
State Superseded
Headers show

Comments

Lucas Moscovicz - Feb. 6, 2014, 7:42 p.m.
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz@fb.com>
# Date 1391715436 28800
#      Thu Feb 06 11:37:16 2014 -0800
# Node ID 3ab8d986e51808fc3e56e63125a6a38a9d0d2418
# Parent  eacef209ab9af32854c4f9255bd5552ffb06b23f
revset: added __add__ method to baseset class

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2055,5 +2055,10 @@ 
             x = x.set()
         return baseset([y for y in s if y in x])
 
+    def __add__(self, x):
+        s = self.set()
+        l = [r for r in x if r not in s]
+        return baseset(list(self) + l)
+
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = symbols.values()