obsolete: lazy relation adding
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 10 Jan 2012 19:52:44 +0100
changeset 129 3ad25876ee68
parent 128 6bcbf7f6ceed
child 130 b70fadbccc2a
obsolete: lazy relation adding
hgext/obsolete.py
--- a/hgext/obsolete.py	Tue Jan 10 10:59:18 2012 +0100
+++ b/hgext/obsolete.py	Tue Jan 10 19:52:44 2012 +0100
@@ -300,6 +300,8 @@
             """Add a relation marking that node <sub> is a new version of <obj>"""
             if sub == nullid:
                 sub = None
+            if obj in self._obssubrels.get(sub, set()):
+                return 0
             self._obssubrels.setdefault(sub, set()).add(obj)
             self._obsobjrels.setdefault(obj, set()).add(sub)
             try:
@@ -322,6 +324,7 @@
                 del self._obssubrels
             if '_obsoleteset' in vars(self):
                 del self._obsoleteset
+            return 1
 
         ### obsolete storage
         @util.propertycache