changeset 129:3ad25876ee68

obsolete: lazy relation adding
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 10 Jan 2012 19:52:44 +0100
parents 6bcbf7f6ceed
children b70fadbccc2a
files hgext/obsolete.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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