Commit Graph

70 Commits

Author SHA1 Message Date
Laurent Charignon
a2ad3d1abd phases: make two functions private for phase computation 2015-03-30 15:38:24 -07:00
Laurent Charignon
9430b8ddec phases: add killswitch for native implementation 2015-03-30 12:57:55 -07:00
Laurent Charignon
5e18944310 phases: move pure phase computation in a function 2015-03-30 12:48:15 -07:00
Laurent Charignon
6b06793e68 phase: default to C implementation for phase computation 2015-03-20 11:14:27 -07:00
Angel Ezquerra
6e49f7def8 localrepo: remove all external users of localrepo.sopener
This change touches every module in which repository.sopener was being used, and
changes it for the equivalent repository.svfs.

It should now be possible to remove localrepo.sopener.
2015-01-11 00:25:54 +01:00
Eric Sumner
c8d74ee479 bundlerepo: implement safe phasecache
This patch makes bundlerepo use a subclass of phasecache that will allow phase
boundaries to be moved around, but will never write them to the underlying
repository.
2014-12-18 11:38:48 -08:00
Pierre-Yves David
160c394fe7 phases: read pending data when appropriate
If we are called by a hook and pending data exists, read those.
2014-10-17 22:23:06 -07:00
Pierre-Yves David
578b6cd317 phases: inform transaction-related hooks that a phase was moved
We do not have enough information to provide finer data, but this is still
useful information.
2014-10-12 08:03:20 -07:00
Durham Goode
030db2699f phases: move root phase assignment to it's own function
This moves the initial root phase assignment to it's own function. Future
patches which make phase calculations lazy will use this function to pre-fill
certain phases which can be deduced from the roots.
2014-10-07 11:42:37 -07:00
Durham Goode
0d0869f7ae phases: add invalidate function
Phase cache invalidation was spread all over the place. Let's add a function to
unify it. Later more will be added to this function.
2014-10-07 11:37:54 -07:00
Pierre-Yves David
db81cffcdc phase: attach phase to the transaction instead of the lock
The phase cache file is no longer written on lock release, it is now handled by
the transaction (as changesets and obsolescence markers are).

(Hooray)

As we stop relying on the lock to write phase, repos with no existing phase
information will need to wait for a phase move or a strip to happen in order to
get the first write in the `phaseroots` file. This explain the change in
test-inherit-mode.t.

This should not have any side effects but in very obscure cases where
people interact with pre-2.1 and post-2.1 versions of Mercurial on the
same repo while having MQ patches applied but the MQ extension
disabled from time to time. A case unlikely enough to not be worth
preserving the old behavior with awful hacks.
2014-08-07 14:11:36 -07:00
Pierre-Yves David
60e760ea53 phase: extract the phaseroots serialization in a dedicated method
In most case, the file creation logic will be handled by the
transaction itself. The write method has to stay around for the case
where the repository is modified outside a transaction (strip).
2014-08-07 14:41:00 -07:00
Pierre-Yves David
5f2b50474c phase: add a transaction argument to retractboundary
We now pass a transaction option to this phase movement function. The
object is currently not used by the function, but it will be in the
future.

All call sites have been updated. Most call sites were already enclosed in a
transaction for a long time. The handful of others have been recently
updated in previous commit.
2014-08-05 23:52:21 -07:00
Pierre-Yves David
a9275323db phase: add a transaction argument to advanceboundary
We now pass a transaction option to this phase movement function. The object
is currently not used by the function, but it will be in the future.

All call sites have been updated. Most call sites were already enclosed in a
transaction for a long time. The handful of others have been recently
updated in previous commit.

The retractboundary function remains to be upgraded.
2014-08-06 01:54:19 -07:00
Pierre-Yves David
4d38b093fd pushkey: wrap pushkey phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:54:58 -07:00
Mads Kiilerich
02d72edf5e phases: make order of debug output 'removing unknown node' deterministic 2014-02-20 02:43:17 +01:00
Durham Goode
64d690fd9a rebase: fix rebase aborts when 'tip-1' is public (issue4082)
When aborting a rebase where tip-1 is public, rebase would fail to undo the merge
state. This caused unexpected dirstate parents and also caused unshelve to
become unabortable (since it uses rebase under the hood).

The problem was that rebase uses -2 as a marker rev, and when it checked for
immutableness during the abort, -2 got resolved to the second to last entry in
the phase cache.

Adds a test for the fix. Add exception to phase code to prevent this in the
future.
2013-11-04 19:59:00 -08:00
Mads Kiilerich
eabc047878 spelling: random spell checker fixes 2013-10-24 01:49:56 +08:00
Pierre-Yves David
c894d35e04 destroyed: invalidate phraserevs cache in all case (issue3858)
When revisions are destroyed, the `phaserevs` cache becomes invalid in most case.
This cache hold a `{rev => phase}` mapping and revision number most likely
changed.

Since cc14b89388cb, we filter unknown phases' roots after changesets
destruction.  When some roots are filtered the `phaserevs` cache is invalidated.
But not if none root where destroyed.

We now invalidate the cache in all case filtered root or not.

This bug was a bit tricky to reproduce as in most case we either:
* rebase a set a draft changeset including root (phaserev invalidated)
* strip tip-most changesets (no re-numbering of revision)

Note that the invalidation of `phaserevs` are not strictly needed when only
tip-most part of the history have been destroyed. But I do not expect the
overhead to be significant.
2013-04-15 17:10:58 +02:00
Idan Kamara
e3cd3c1a91 phases: make _filterunknown a member function of phasecache
We'd like the ability to call filterunknown on an existing phasecache
instance after nodes are destroyed.
2013-01-04 06:11:29 +01:00
Pierre-Yves David
e3f34c0ee1 cache: group obscache and revsfiltercache invalidation in a single function
Both caches are very volatile and needs invalidation on the same kind of event.
revsfiltercache actually depends on the content of revsfiltercache.
2012-12-18 02:04:37 +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
fd66efd696 clfilter: phases logic should be unfiltered
Phase computations and boundary movements need to be aware of all
revisions that exist in the repository to return correct results.
2012-11-21 00:53:45 +01:00
André Sintzoff
94ef5e50d6 phases: fix missing "error" module import (issue3707) 2012-11-25 20:39:37 +01:00
Pierre-Yves David
5ae3830b30 clfilter: introduce a hassecret function
We can only use copy clone if the cloned repo do not have any secret changeset.
The current method for that is to run the "secret()" revset on the remote repo.
But with proper filtering of hidden or unserved revision by the remote this
revset won't return any revision even if some exist remotely. This changeset
adds an explicit function to know if a repo have any secret revision or not.

The other option would be to disable filtering for the query but I prefer the
approach above, lighter both regarding code and performance.
2012-09-03 14:05:19 +02:00
Bryan O'Sullivan
dc9ede17dc Merge spelling fixes 2012-09-11 08:36:09 -07:00
Pierre-Yves David
785d90eba0 obsolete: introduce caches for all meaningful sets
This changeset introduces caches on the `obsstore` that keeps track of sets of
revisions meaningful for obsolescence related logics. For now they are:

- obsolete: changesets used as precursors (and not public),
- extinct:  obsolete changesets with osbolete descendants only,
- unstable: non obsolete changesets with obsolete ancestors.

The cache is accessed using the `getobscache(repo, '<set-name>')` function which
builds the cache on demand. The `clearobscaches(repo)` function takes care of
clearing the caches if any.

Caches are cleared when one of these events happens:

- a new marker is added,
- a new changeset is added,
- some changesets are made public,
- some public changesets are demoted to draft or secret.

Declaration of more sets is made easy because we will have to handle at least
two other "troubles" (latecomer and conflicting).

Caches are now used by revset and changectx. It is usually not much more
expensive to compute the whole set than to check the property of a few elements.
The performance boost is welcome in case we apply obsolescence logic on a lot of
revisions. This makes the feature usable!
2012-08-28 20:52:04 +02:00
timeless@mozdev.org
bff9a96ea4 en-us: serialization 2012-08-17 13:58:19 -07:00
Mads Kiilerich
2372d51b68 fix wording and not-completely-trivial spelling errors and bad docstrings 2012-08-15 22:39:18 +02:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Pierre-Yves David
afa28ff113 repo: move visibleheads and visiblebranchmap logic in discovery
They were previously inside the mercurial.phases module, but obsolete
logic will need them to exclude `extinct` changesets from pull and
push.

The proper and planned way to implement such filtering is still to apply a
changelog level filtering. But we are far to late in the cycle to implement and
push such a critical piece of code (changelog filtering). With Matt Mackall
approval I'm extending this quick and dirty mechanism for obsolete purpose.

Changelog level filtering should come during the next release cycle.
2012-07-17 01:22:31 +02:00
Bryan O'Sullivan
141bd09daa revlog: descendants(*revs) becomes descendants(revs) (API)
Once again making the API more rational, as with ancestors.
2012-06-01 12:45:16 -07:00
Martin Geisler
e0d9047429 phases: wrap docstrings at 70 characters 2012-05-13 12:07:49 +02:00
Martin Geisler
79a3fc20d2 phases: fix typos in docstrings 2012-05-13 12:06:12 +02:00
Patrick Mezard
aa6e824ce1 phase: make if abort on nullid for the good reason
The good reason being you cannot call retractboundary() on nullid, not
revset.set() cannot resolve '-1'.
2012-05-12 00:24:07 +02:00
Patrick Mezard
ed5fc49c44 phases: make advance/retractboundary() atomic
Before this, if advanceboundary() failed after updating some roots but
before calling retractboundary(), the phase cache would be left in an
invalid state, marked dirty, and written as such. This patch approach is
to turn advance/retractboundary() into phasecache methods, then operate
on copies and merge them back on success.

With the same technique, we can ensure the atomicity of combinations of
advance/retractboundary() calls, like those performed in changegroup
handling code.
2012-05-12 00:24:07 +02:00
Patrick Mezard
641ee7d3ba phases: introduce phasecache
The original motivation was changectx.phase() had special logic to
correctly lookup in repo._phaserev, including invalidating it when
necessary. And at other places, repo._phaserev was accessed directly.

This led to the discovery that phases state including _phaseroots,
_phaserev and _dirtyphase was manipulated in localrepository.py,
phases.py, repair.py, etc. phasecache helps encapsulating that.

This patch replaces all phase state in localrepo with phasecache and
adjust related code except for advance/retractboundary() in phases.
These still access to phasecache internals directly. This will be
addressed in a followup.
2012-05-12 00:24:07 +02:00
Patrick Mezard
352ebc2cec phases: stop modifying localrepo in writeroots()
Also pass the phaseroots being written for clarity. repo._dirtyphases
was already reset to False at call site.
2012-05-10 18:52:07 +02:00
Patrick Mezard
f8945add9d phases: stop modifying localrepo in readroots()
phasedefaults is also passed explicitely to help the casual reader
understand where it is used without grepping all the sources.
2012-05-10 18:52:04 +02:00
Patrick Mezard
e918020a6f phases: call filterunknown() in readroots()
One less function manipulating localrepo state.
2012-05-10 18:21:15 +02:00
Martin Geisler
f8393191de phases: line.strip().split() == line.split() 2012-05-04 15:24:00 +02:00
Pierre-Yves David
c37b1089b6 branchmap: server should not advertise secret changeset in branchmap (Issue3303)
Discovery now use an overlay above branchmap to prune invisible "secret"
changeset from branchmap.

To minimise impact on the code during the code freeze, this is achieve by
recomputing non-secret heads on the fly when any secret changeset exists. This
is a computation heavy approach similar to the one used for visible heads. But
few sever should contains secret changeset anyway.  See comment in code for more
robust approach.

On local repo the wrapper is applied explicitly while the wire-protocol take
care of wrapping branchmap call in a transparent way. This could be unified by
the Peter Arrenbrecht and Sune Foldager proposal of a `peer` object.

An inappropriate `(+i heads)` may still appear when pushing new changes on a
repository with secret changeset. (see Issue3394 for details)
2012-04-24 16:32:44 +02:00
Greg Ward
ec41fc8bf6 phases: fix a non-standard debug message
- add missing newline
- ditch gratuitous use of string formatting with dict
- fix so it actually does string formatting ('%' rather than ',')
- inline unnecessary local variable
- downcase first word
2012-02-15 17:30:21 -05:00
Matt Mackall
826c35e4f4 phases: don't complain if cset is already public on pushkey (issue3230) 2012-02-01 14:17:26 -06:00
Pierre-Yves David
ad2799644a phases: allow phase name in phases.new-commit settings
Before this commit only phase index where accepted
2012-01-30 17:46:15 +01:00
Pierre-Yves David
06ca6deaf4 phases: write default phase data as soon as possible.
Marks phase data as dirty when computing default phase. Actual writing is done
when the lock is released. So, read only operation don't write phase data
because they don't lock the repo.
2012-01-30 17:33:09 +01:00
Pierre-Yves David
638304be51 phase: extracts heads computation logics from analyzeremotephases 2012-01-20 19:23:53 +01:00
Pierre-Yves David
bcece1636b phase: fix warning text from invalid remote phase
add missing end of line and substitution.
2012-01-20 19:18:09 +01:00
Wagner Bruna
ce7ff22344 phases: do not mark debug message for translation 2012-01-20 13:19:32 -02:00
Wagner Bruna
2034ccc9cf phases: fix typo in warning message 2012-01-20 12:57:13 -02:00