Commit Graph

41 Commits

Author SHA1 Message Date
Augie Fackler
f41d193435 merge with stable 2014-09-04 09:59:23 -04:00
Mike Hommey
edf6a59652 repoview: fix typo in repoview.changelog
Incidentally, this avoids the changelog cache being invalidated each time
it's accessed on a repoview.

On a filtering experiment on a repository the size of mozilla-central,
this makes a significant difference:

Before, running hg log -l 10 --time with about 8k changesets filtered out:
time: real 1.490 secs (user 1.450+0.000 sys 0.040+0.000)

After:
time: real 0.540 secs (user 0.530+0.000 sys 0.010+0.000)
2014-08-31 19:43:03 +09:00
Matt Mackall
9bc396577d repoview: fix 0L with pack/unpack for 2.4 2014-08-26 13:11:53 +02:00
Matt Mackall
17ab77f157 repoview: filter tags to non-existent nodes from blockers (issue4328) 2014-08-12 02:40:42 -05:00
Augie Fackler
cceb152b73 repoview: use util.sha1() instead of hashlib.sha1()
6f2e3119e8a1 accidentally broke Python 2.4 compatibility, this fixes it.
2014-08-20 13:21:41 -04:00
Matt Mackall
7a0d67564b repoview: fix try/except/finally for py2.4 2014-08-14 16:39:02 -05:00
David Soria Parra
698eea6e2b repoview: cache hidden changesets
Use the introduced caching infrastructure to cache hidden
changesets. We crosscheck if the content of the cache unless
experimental.verifyhiddencache is set to False. This will be removed
in the future. Without crosschecking the caches speed ups hg status and
other commands:

without caching:
$ time hg status
hg status  0.72s user 0.20s system 100% cpu 0.917 total

with caching
$ time hg status
hg status  0.49s user 0.15s system 100% cpu 0.645 total
2014-08-12 09:39:14 -07:00
David Soria Parra
75f779a75d repoview: add caching bits
Add a caching infrastructure to cache hidden changesets. The cache tries to read
the cache lazily and falls back to recomputing if no wlock can be obtain.
To validate the cache we store a sha of the obstore content and repo heads in
the beginning of the cache which we check every request.
2014-08-12 16:48:54 -07:00
David Soria Parra
c878b027dc repoview: split _gethiddenblockers
Split up _gethiddenblockers into two categories: (1) "static' blockers
that solely rely on the contents of obstore and are visible children of
hidden changsets. (2) "dynamic" blockers, appearing by having wd parents,
bookmarks or tags pointing to hidden changesets.

We assume that (1) doesn't change often and can be easily cached with a good
invalidation strategy. (2) change often, but barely produce blockers, so we
can recompute them if necessary.
2014-08-06 13:26:04 -07:00
David Soria Parra
70d1fce0ac repoview: use set for blockers
Blockers should be unique but tags and bookmarks could point to the same rev,
therefore use a set to ensure that we don't have duplicates.
2014-08-12 16:42:24 -07:00
Pierre-Yves David
05993ab1e8 repoview: make the conversion from node to rev explicit while computing hidden
You cannot use `repo[...]` lookup here. 1. It is slow 2. It is very likely to
trigger a hidden computation itself, entering an infinite loop.
2014-04-13 16:36:51 -04:00
Pierre-Yves David
d9ed66d8f6 repoview: drop duplicated lookup
We are already looking for local tags on the line above. We can safely drop
this extra lookup.
2014-04-13 16:39:31 -04:00
Sean Farley
320875017e repoview: use _gethiddenblockers in computehidden
No functionality has changed, since we've only extracted the code into its own
function. Now extensions can wrap _gethiddenblockers to provide their own
blocker without polluting bookmarks or local tags.
2014-03-28 12:51:05 -05:00
Sean Farley
844f2d5df4 repoview: add _gethiddenblockers method
This is a standalone function that will provide the ability for extensions to
wrap.
2014-04-03 20:07:42 -05:00
Sean Farley
13250b1f33 repoview: improve performance for computehidden (issue4206)
For repos with a large number of heads (including hidden heads), a stale tag
cache would cause computehidden to be drastically slower because of a the call
to repo.tags() (which would build the tag cache).

We actually don't need the tag cache for computehidden because we filter out
global tags. This patch replaces the call to repo.tags with readlocaltags so
as to avoid the tag cache.
2014-03-27 20:14:55 -05:00
Sean Farley
9b0f10caf6 repoview: add non-global tags to candidate list for blocking hidden changesets
Previously, only bookmarks would be considered for blocking a changeset from
being hidden. Now, we also consider non-global tags. This is helpful if we have
local tags that might be hard to find once they are hidden, or tag that are
added by extensions (e.g. hggit or remotebranches).
2014-03-18 20:10:33 -05:00
Mads Kiilerich
92dc407d90 comments: fix minor spelling issues found with spell checker 2014-02-20 02:39:01 +01:00
Augie Fackler
859551f9b1 repoview: use repo.revs() instead of a private revset method
Breaks an import cycle.
2014-02-04 17:13:45 -05:00
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