[PATCH 10 of 17 RFC] clfilter: do not use tags cache if there are filtered changesets

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Mon Sep 3 07:58:34 CDT 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1346675705 -7200
# Node ID d48764c1f231ae0aadb75b14a4176236c9dbf40a
# Parent  102543f9db9acd7309ee4d4de0bfa3c5cc67f2a2
clfilter: do not use tags cache if there are filtered changesets

If there are filtered changesets the cache is not valid. We'll have to cache
tags for filtered state too, but for now recomputing the tags is enough.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -514,11 +514,15 @@ class localrepository(object):
         return cache
 
     def tags(self):
         '''return a mapping of tag to node'''
         t = {}
-        for k, v in self._tagscache.tags.iteritems():
+        if self.changelog.filteredrevs:
+            tags, tt = self._findtags()
+        else:
+            tags = self._tagscache.tags
+        for k, v in tags.iteritems():
             try:
                 # ignore tags to unknown nodes
                 self.changelog.rev(v)
                 t[k] = v
             except (error.LookupError, ValueError):


More information about the Mercurial-devel mailing list