Commit Graph

23 Commits

Author SHA1 Message Date
Pierre-Yves David
de4bc2f6f8 filter: add a comment so that people do not forget to update subsettable
Changeset aad678a92970 moved `subsettable` from `mercurial/repoview.py` to
`mercurial/branchmap.py`. This mean that `filtertable` and `subsettable` are no
longer next to each other. So we add a comment to remind people to update both.
2013-12-24 17:44:23 -05:00
Augie Fackler
2859ed15ec subsettable: move from repoview to branchmap, the only place it's used
This is a step towards breaking an import cycle between revset and
repoview. Import cycles happened to work in Python 2 with implicit
relative imports, but breaks on Python 3 when we start using explicit
relative imports via 2to3 rewrite rules.
2013-11-06 14:38:34 -05:00
Bryan O'Sullivan
6bdbf1a461 repoview: remove unreachable code
Found using Cython.
2013-04-12 17:18:52 -07:00
Mads Kiilerich
5787baee50 spelling: fix some minor issues found by spell checker 2013-02-10 18:24:29 +01:00
Kevin Bullock
921b868783 bookmarks: don't use bookmarks.listbookmarks in local computations
bookmarks.listbookmarks is for wire-protocol use. The normal way to get
all the bookmarks on a local repository is repo._bookmarks.
2013-01-27 14:24:37 -06:00
Pierre-Yves David
988fc3a302 documentation: update to new filter names
Changeset 7f7f8386b285 change filter names but forgot some documentation
updates.
2013-01-21 19:40:15 +01:00
Pierre-Yves David
d6838f12a9 repoview: cache filtered changelog
Creating a new changelog object for each access is costly and prevents efficient
caching changelog side. This introduced a x5 performance regression in log
because chunk read from disk were never reused. We were jumping from about 100
disk read to about 20 000.

This changeset introduce a simple cache mechanism that help the last changelog
object created by a repoview. The changelog is reused until the changelog or the
filtering changes.

The cache invalidation is much more complicated than it should be. But MQ test
show a strange cache desync. I was unable to track down the source of this
desync in descent time so I'm not sure if the issue is in MQ or core. However
given the proximity to the 2.5 freeze, I'm choosing the inelegant but safe route
that makes the cache mechanism safer.
2013-01-18 23:43:32 +01:00
Pierre-Yves David
f539d0189a repoview: protect base computation from weird phase root
If for some reason the phase roots contains nullid, the set of filtered revs
will contains -1. That confuse Mercurial a lot. In particular this corrupt the
branchcache.

Standard code path does not result in nullid phase root. It can only result from
altered `.hg/store/phaseroots` or buggy extension. However better safe than
sorry.
2013-01-17 17:51:30 +01:00
Kevin Bullock
93f9cb7f25 filtering: rename filters to their antonyms
Now that changelog filtering is in place, it's become evident that
naming the filters according to the set of revs _not_ included in the
filtered changelog is confusing. This is especially evident in the
collaborative branch cache scheme.

This changes the names of the filters to reflect the revs that _are_
included:

  hidden -> visible
  unserved -> served
  mutable -> immutable
  impactable -> base

repoview.filteredrevs is renamed to filterrevs, so that callers read a
bit more sensibly, e.g.:

  filterrevs('visible') # filter revs according to what's visible
2013-01-13 01:39:16 -06:00
Pierre-Yves David
bf6aa861ef repoview: extract hideable revision computation in a dedicated function
This will help extensions to plug into the hidden mechanism.
2013-01-10 10:25:02 +01:00
Pierre-Yves David
1974a3ac5d performance: speedup computation of mutable revisions
In their current state, revset calls can be very costly, as we test
predicates on the entire repository. The "mutable" filter is used
during branch cache loading operation. We need to make it fast.

This change drops revset calls in favor of direct testing of the
phase of a changeset.

Performance test on my Mercurial checkout
- 19857 total changesets,
- 1646 mutable revision

Before:
  ! mutable
  ! wall 0.032405

After:
  ! mutable
  ! wall 0.001469

Performance test on a Mozilla central checkout:
- 117293 total changesets,
- 1 mutable changeset,

Before:
  ! mutable
  ! wall 0.188636

After:
  ! mutable
  ! wall 0.000022
2013-01-07 15:50:25 +01:00
Pierre-Yves David
fcce734523 performance: speedup computation of unserved revisions
In their current state, revset calls can be very costly, as we test
predicates on the entire repository. The "unserved" filter is used
in multiple applications, and in particular in some branch cache
loading operations. We need to make it fast.

This change drops revset calls in favor of direct testing of the
phase of a changeset.

Performance test on my Mercurial checkout

- 19857 total changesets,
- 1584 obsolete changesets,
- 13310 obsolescence markers.

Before:
  ! unserved
  ! wall 0.030477

After:
  ! unserved
  ! wall 0.011844

Performance test on a Mozilla central checkout:

- 117293 total changesets,
- 1 obsolete changeset,
- 1 obsolescence marker.

Before:
  ! unserved
  ! wall 0.111259

After:
  ! unserved
  ! wall 0.000084
2013-01-04 20:19:05 +01:00
Pierre-Yves David
48ff92e0ee performance: speedup computation of hidden revisions
In their current state, revset calls can be very costlys, as we
test predicates on the entire repository. The hidden filter is very
widely used, and needs to be very fast.

This change drops revset calls in favor of direct revision manipulation.

Performance test on my Mercurial checkout

- 19857 total changesets,
- 1584 obsolete changesets,
- 13310 obsolescence markers.

Before:
 ! hidden
 ! wall 0.077553

After this changes:
  ! hidden
  ! wall 0.011230

Performance test on a Mozilla central checkout:

- 117293 total changesets,
- 1 obsolete changeset,
- 1 obsolescence marker.

Before:
  ! hidden
  ! wall 0.389472

After:
  ! hidden
  ! wall 0.000079
2013-01-04 05:44:01 +01:00
Pierre-Yves David
f3980b618d hidden: use both parents of working directory
If we are merging with and extinct revision, this extinct revision should not be
hidden.
2013-01-08 17:31:00 +01:00
Pierre-Yves David
d9a61344d3 hidden: move computation in filter function
There is not good reason for this computation to be handle in a different way
from the other. We are moving the computation of hidden revs in the filter
function. In later changesets, code that access to `repo.hiddenrevs` will be
updated and the property dropped.
2013-01-08 14:10:29 +01:00
Pierre-Yves David
4ba45ce409 clfilter: add impactable filter
The `mutable` filter still have some chance to get invalidated. This will happen
when:

- you garbage collect hidden changeset,
- public phase is moved backward,
- something is changed in the filtering (this could be fixed)

So we introduce an even more stable filtering set: everything with a revision
number egal or higher than the first mutable changeset is filtered.

The only official use of this filter is for branchcache.
2013-01-02 02:02:41 +01:00
Pierre-Yves David
047cb49651 clfilter: add mutable filtering
It filters all mutable changesets, leaving only public changeset unfiltered.
This filtering set is expected to be much more stable that the previous one as
public changeset are unlikely to disapear.

The only official use of this filter is for branchcache.
2013-01-02 01:57:46 +01:00
Pierre-Yves David
8d44b2181d clfilter: introduces a hidden filter
This filter exclude all hidden revision. We plan to use this filter to hide
revision instead of manually checking contents of the hidden revisions set.
2013-01-07 19:24:06 +01:00
Pierre-Yves David
fadd8efa6b repoview: add a subset table
This will be used by branchmap collaboration. See inline documentation for more
details
2013-01-07 17:16:24 +01:00
Pierre-Yves David
842d7e9f52 clfilter: use empty frozenset intead of empty tuple
This will allows set operation needed for cache collaboration.
2013-01-02 01:40:06 +01:00
Pierre-Yves David
78f77e2591 clfilter: introduce a "unserver" filtering mode
This mode is for repository used as a server. It filter secret and hidden
changeset out.

It is put to use in later changeset.
2012-12-17 17:12:02 +01:00
Pierre-Yves David
0ea6453a8a clfilter: add a cache on repo for set of revision to filter for a given set.
Recomputing the filtered revisions at every access to changelog is far too
expensive. This changeset introduce a cache for this information. This cache is
hold by the repository (unfiltered repository) and invalidated when necessary.
This cache is not a protected attribute (leading _) because some logic that
invalidate it is not held by the local repo itself.
2012-12-20 17:14:07 +01:00
Pierre-Yves David
4d4c1e240e clfilter: add actual repo filtering mechanism
We add a `filtered` method on repo. This method return an instance of `repoview`
that behaves exactly as the original repository but with a filtered changelog
attribute. Filters are identified by a "name". Planned filter are `unserved`,
`hidden` and `mutable`. Filtering the repository in place what out of question
as it wont not allows multiple thread to share the same repo. It would makes
control of the filtering scope harder too. See the `repoview` docstring for
details.

A mechanism to compute filtered revision is also installed. Some caches will be
installed in later commit.
2012-12-20 15:32:42 +01:00