# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1357575805 -3600
# Node ID 6f276a9239897787171cc86cb7fa7d169dffbf8f
# Parent  f5d89f804e6f5eb337273052077f2757238e626d
branchmap: allow to use cache of subset

Filtered repository are *subset* of unfiltered repository. This means that a
filtered branchmap could be use to compute the unfiltered version.

And filtered version happen to be subset of each other:
- "all() - unserved()" is a subset of "all() - hidden()"
- "all() - hidden()" is a subset of "all()"

This means that branchmap with "unfiltered" filter can be used as a base for
"hidden" branchmap that itself could be used as a base for unfiltered
branchmap.

   unserved < hidden < None

This changeset implements this mechanism. If the on disk branchcache is not valid
we use the branchcache of the nearest subset as base instead of computing it from
scratch. Such fallback can be cascaded multiple time is necessary.

Note that both "hidden" and "unserved" set are a bit volatile. We will add more
stable filtering in next changesets.

This changeset enables collaboration between no filtering and "unserved"
filtering. Fixing performance regression introduced by 47f00b0de337

[ original upstream message ]

diff -r f5d89f804e6f -r 6f276a923989 tests/test-keyword.t
--- a/tests/test-keyword.t	Mon Jan 07 02:00:43 2013 +0100
+++ b/tests/test-keyword.t	Mon Jan 07 17:23:25 2013 +0100
@@ -747,7 +747,9 @@
 Commit with multi-line message and custom expansion
 
   $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
+  invalid branchheads cache: tip differs
   a
+  invalid branchheads cache: tip differs
   overwriting a expanding keywords
   committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
   $ rm log
@@ -789,6 +791,8 @@
   $ hg debugrebuildstate
   $ hg remove a
   $ hg --debug commit -m rma
+  invalid branchheads cache: tip differs
+  invalid branchheads cache: tip differs
   committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
   $ hg status
   ? c
@@ -899,8 +903,10 @@
   [255]
   $ cd x
   $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
+  invalid branchheads cache: tip differs
   x/a
    x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
+  invalid branchheads cache: tip differs
   overwriting x/a expanding keywords
   committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
   $ cat a