branchmap: move validity logic in the object itself
In several place, We check if a branchcache is still valid regarding the current
state of the repository. This changeset puts this logic in a method of the object
that can be reused when necessary.
A branch map is considered valid whenever it is up to date or a strict subset of
the repository state.
The change will help making branchcache aware of filtered revision.
The change in keyword is expected. the branch cache is actually invalid after
the amend. The previous check did not detected it.
[ original upstream message ]
--- a/tests/test-keyword.t Wed Dec 12 15:17:18 2012 -0800
+++ b/tests/test-keyword.t Mon Dec 24 02:49:59 2012 +0100
@@ -507,6 +507,7 @@
$ hg -q commit -d '14 1' -m 'prepare amend'
$ hg --debug commit --amend -d '15 1' -m 'amend without changes' | grep keywords
+ invalidating branch cache (tip differs)
overwriting a expanding keywords
$ hg -q id
67d8c481a6be