diff obsolete.py @ 40:b9a5a596d9ef

proper computation of hidden changeset.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 07 Sep 2011 12:42:26 +0200
parents b12655157ba0
children 99c131e97bb3
line wrap: on
line diff
--- a/obsolete.py	Wed Sep 07 12:09:05 2011 +0200
+++ b/obsolete.py	Wed Sep 07 12:42:26 2011 +0200
@@ -9,6 +9,7 @@
 from mercurial import util
 from mercurial import context
 from mercurial import revset
+from mercurial import scmutil
 from mercurial.node import hex, bin
 
 # Patch changectx
@@ -24,7 +25,14 @@
 
 ohidden = context.changectx.hidden
 def hidden(ctx):
-    ctx._repo._obsobjrels # XXX hack to fill hiddenrevs
+    # hack to fill hiddenrevs
+    # compute hidden (XXX should move elsewhere)
+    if not getattr(ctx._repo.changelog, 'hiddeninit', False):
+        basicquery = 'obsolete() - (ancestors(not obsolete()))'
+        for rev in scmutil.revrange(ctx._repo, [basicquery]):
+            ctx._repo.changelog.hiddenrevs.add(rev)
+        ctx._repo.changelog.hiddeninit = True
+
     return ohidden(ctx)
 context.changectx.hidden = hidden
 
@@ -74,10 +82,6 @@
                 for obj in objs:
                     objrels.setdefault(obj, set()).add(sub)
 
-            # compute hidden (XXX should move elsewhere)
-            for obj in objrels:
-                self.changelog.hiddenrevs.add(repo[obj].rev())
-
             #
             return objrels