Commit Graph

48 Commits

Author SHA1 Message Date
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
Pierre-Yves David
7448ca3281 phases: mechanism to allow extension to alter initial computation of phase
This commit add a whennodata list where extension can register a callback to be
called if no phase related data are found in the repository.

The goal is to ensure the existing extension that move phase data in 2.1 can
compute consistent phase boundary for existing repo.
2012-01-18 17:23:54 +01:00
Sune Foldager
e577300102 phases: use nodemap to check for missing nodes 2012-01-18 16:46:15 +01:00
Pierre-Yves David
387f9b40ba phases: simplify phase exchange and movement over pushkey
The code now only exchange draft root and only care about movement related to
public//draft boundary.

There is multiple reason to simplify this code:
    * Secret are never discovered anymore
    * We decided to not support more the three existing phase

Removing phase index from pushkey (if ever decided) will be made in another commit.
2012-01-13 02:04:16 +01:00
Pierre-Yves David
b612e4cf38 phases: add list of string to access phase name 2012-01-04 01:02:16 +01:00
Pierre-Yves David
5262f88500 phases: store phase values in constant instead of using raw integer
Phases constant are named after the phase name. Usage of integer have been
replaced by proper constant.
2012-01-06 09:51:35 +01:00
Pierre-Yves David
dd39afe5c4 phases: update doc to mention secret phase 2011-12-20 01:34:12 +01:00
Pierre-Yves David
1fd5692284 phases: add a function to compute visible heads
This function will be used to hide secret changeset.
2011-12-19 11:37:44 +01:00
Pierre-Yves David
3d9a6a91e3 phases: Add a third phase for secret changeset 2011-12-18 23:16:46 +01:00
Pierre-Yves David
d7a17ef9c1 phases: fix advanceboundary behavior when targetphase !=0
Changeset was properly removed from upper phase but was not explicitly added to
target phase. If advanced changesets had not pwasnt in target phase they was
considered public (0-phase).
2011-12-19 11:29:39 +01:00
Pierre-Yves David
f9b3764a1f phases: change publish behavior to only alter behavior when server.
Older publish=True was:

  1) Content of Publishing server are seen as public by client.
  2) Any changegroup *added* to a publish=True server is public.

New definition are:

  1) Content of Publishing server are seen as public by client.
  2) Any changegroup *pushed* to a publish=True server is public.

See mercurial/phase.py documentation for exact final behavior
2011-12-15 23:08:09 +01:00
Pierre-Yves David
28f802f934 phases: add a function to compute heads from root 2011-12-15 02:18:24 +01:00
Pierre-Yves David
a6373d74dc phases: add basic pushkey support 2011-12-15 11:24:26 +01:00
Pierre-Yves David
c97518dfab phases: add retractboundary function to move boundary backward
The advanceboundary documentation is updated to highlight the difference.
2011-11-11 00:16:53 +01:00
Pierre-Yves David
241fc82f4e phases: rename moveboundary into advance boundary
This rename prepare the creation of retract boundaru that move boundary backward
2011-11-10 01:09:15 +01:00
Pierre-Yves David
1401cbb897 phases: remove underbar into target_phase argument 2011-11-10 01:08:08 +01:00
Pierre-Yves David
e62e01ae47 phases: handle unknown nodes in boundary
We filter unknown node out of the boundary. No data is lost. A
filtering is explicitly done after strip too
2011-11-07 13:20:22 +01:00
Pierre-Yves David
7ab6d68a9a phases: add a moveboundary function to move phases boundaries
Also include logic to detect when to write phases data.
2011-11-07 14:11:01 +01:00
Matt Mackall
b887acee5d phases: handle errors other than ENOENT appropriately 2011-11-06 11:57:24 -06:00
Pierre-Yves David
ff2323c4af phases: basic I/O logic
Add function to read and write phase roots. Add a _phaseroots filecache on
localrepo class to access the phaseroots data.
2011-11-04 00:16:24 +01:00
Pierre-Yves David
8b33094602 phases: Minimal first add. 2011-11-03 23:49:14 +01:00