[PATCH] changelog: make native head computation aware of filtering

Laurent Charignon lcharignon at fb.com
Wed May 20 18:01:30 CDT 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1432162260 25200
#      Wed May 20 15:51:00 2015 -0700
# Node ID a89ff1dfbc175d72d6654ec6e94e52fe81c1875c
# Parent  a39c35e8e559e238f311c647679e8de3b91748c6
changelog: make native head computation aware of filtering

The code to compute the heads natively was returning all of the heads of
the repository regardless of filtering state. This patch makes the native
implementation of headrevs() discard the filtered heads matching the pure
implementation.

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -175,7 +175,9 @@
     def headrevs(self):
         if self.filteredrevs:
             try:
-                return self.index.headrevsfiltered(self.filteredrevs)
+                return [h for h
+                          in self.index.headrevsfiltered(self.filteredrevs)
+                          if h not in self.filteredrevs]
             # AttributeError covers non-c-extension environments and
             # old c extensions without filter handling.
             except AttributeError:


More information about the Mercurial-devel mailing list