Commit Graph

1165 Commits

Author SHA1 Message Date
Pierre-Yves David
fc633e8922 strip: do not update branchcache during strip (issue3745)
At this moment, the cache is invalid, and will be thrown away.
Later the strip function will call the `localrepo.destroyed` method
that will update the branchmap cache.
2012-12-28 00:02:40 +01:00
Pierre-Yves David
5e4e0ce72d branchmap: make update a method 2012-12-22 17:08:15 +01:00
Pierre-Yves David
3b1070cfe3 branchmap: make update responsible to update the cache key
The update function have all necessary data to keep the branchcache key
up to date with its value.

This saves assignment to the cache key that each caller of update had to do by
hand.

The strip case is a bit more complicated to handles from inside the function but
I do not expect any impact.
2012-12-24 02:22:04 +01:00
Pierre-Yves David
a3a3d2bc58 branchmap: make write a method on the branchmap object 2012-12-20 16:28:43 +01:00
Pierre-Yves David
1bc937448e branchmap: simplify write signature
All necessary data (cache value and key) are now stored in the branchcache
object. Any extra parameter is superfluous.
2012-12-22 02:04:49 +01:00
Pierre-Yves David
9602b376b6 branchmap: add the tiprev (cache key) on the branchmap object
The actual cache key used on disk is the (tipnode, tiprev) pair. There is no
reason not to use the revision number for the in memory version.
2012-12-22 02:06:26 +01:00
Pierre-Yves David
72ccce9263 branchmap: add the tipnode (cache key) on the branchcache object
Gathering data and cache key paves the way to a lot of simplification.
2012-12-22 01:59:05 +01:00
Pierre-Yves David
0b84a3fa35 branchmap: store branchcache in a dedicated object
Value and key of branchcache would benefit from being hold by the same object.
Moreover some logic (update, write, validation) could be move on such object.

The creation of this object is the first step toward this move. The result will
clarify branchcache related code and hide most of the detail in the class
itself. This encapsulation will greatly helps implementation of branchcache for
filtered view of the repo.
2012-12-22 01:44:42 +01:00
Pierre-Yves David
81a9a63850 branchmap: stream_in write remote branchcache to local one
The previous code was writing it to a non existent `branchcache` attribute.  We
now write is to the proper `_branchcache` attribute and initialize the
`_branchcachetip` at the same time.

We keep writing it to disk, the previous code had this part right.
2012-12-22 01:34:23 +01:00
Pierre-Yves David
dc5b484bd1 branchmap: extract updatebranchcache from repo 2012-12-20 14:45:17 +01:00
Pierre-Yves David
0e27877238 branchmap: extract _updatebranchcache from repo 2012-12-19 14:49:06 +01:00
Pierre-Yves David
92d0e6ec35 branchmap: _updatebranchmap does not need to be filtered
The `_updatebranchmap` method on repo does not need to be filtered as all
callers are already handling filtering themself.

The fact it is filtered may had even lead to buggy behaviors, but by chances the method
make very sparse use of the repo object.
2012-12-19 14:47:38 +01:00
Pierre-Yves David
b588a59cfa branchmap: extract read logic from repo 2012-12-19 14:46:57 +01:00
Pierre-Yves David
ef0f47c598 branchmap: extract write logic from localrepo 2012-12-20 13:37:37 +01:00
Pierre-Yves David
5587346fea branchmap: merge _branchtags into updatebranchcache
Now that nobody overwrite it, there is no reasons for `_branchtags` to remains
separated from `updatebranchcache`.
2012-12-20 13:23:29 +01:00
Pierre-Yves David
18004c817a branchmap: factorise access to changelog in updatebranchcache
This prepares merge of `updatebranchcache` and `_branchtags`.
2012-12-19 17:39:49 +01:00
Pierre-Yves David
6f3f4215a3 branchmap: simplify _branchtags using a new _cacheabletip method
The current _branchtags method is a remnant of an older, much larger function.
Its only remaining role is to help MQ to alter the version of branchcache we
store on disk. As MQ mutates the repository it ensures persistent cache does not
contain anything it is likely to alter.

This changeset makes explicit the stable vs volatile part of repository and
reduces the MQ specific code to the computation of this limit. The main
_branchtags code now handles this possible limit in all cases.

This will help to extract the branchmap logic from the repository.

The new code of _branchtags is a bit duplicated, but as I expect major
refactoring of this section I'm not keen to setup factorisation function here.
2012-12-20 11:52:50 +01:00
Pierre-Yves David
fa2bc9d633 hidden: invalidate hiddenrevs when needed
The `hiddenrevs` cache is volatile too (It use content from `obscache`). When
unsure it is invalidated when necessary. In a near future, the cache will
probably be moved to `revsfiltercache`
2012-12-18 01:51:08 +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
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
Siddharth Agarwal
28d6c979cc localrepo: use lazy ancestor membership testing
For a repository with over 400,000 commits, rebasing one revision near tip,
this avoids two treks up the DAG, speeding the operation up by around 1.6
seconds.
2012-12-17 20:43:37 -08:00
Pierre-Yves David
fe7c7f379e clfilter: fix nodemap usage in getbundle
With the current implementation, `changelog.nodemap` is not filtered. So some
filtered changeset in common are not filtered by `n in nodemap`. This leads to
crash lower in the stack when the bundle generation try to access those node on
a filtered changelog.
2012-12-10 18:12:41 +01:00
Pierre-Yves David
2038eca723 obsolete: refuse to push divergent changeset
As other troubles `unstable` and `bumped`. Followup patches may simplify the
push code with unification of "obsolescence troubles" handling.
2012-11-10 02:19:20 +01:00
Mads Kiilerich
ac8e1fc147 check-code: there must also be whitespace between ')' and operator
The check pattern only checked for whitespace between keyword and operator.

Now it also warns:
 >     x = f(),7
 missing whitespace after ,
 >     x = f()+7
 missing whitespace in expression
2012-12-09 23:33:16 +01:00
Kevin Bullock
1ff9eb737c push: reunite comment with the line of code it describes 2012-12-07 12:03:37 -06:00
Pierre-Yves David
5ccc6bfa9a clfilter: rename unfilteredmeth to unfilteredmethod
As originally intended.
2012-11-30 22:34:21 +01:00
Pierre-Yves David
ff24df652d clfilter: ensure that filecache on localrepo is unfiltered
All filecache usage on repo is for logic that should be unfiltered. The
caches should be common to all filtered instances, and computation must
be done unfiltered.  A dedicated storecache subclass is created for
this purpose.
2012-10-08 19:34:04 +02:00
Pierre-Yves David
b25a880a8e clfilter: add a propertycache that must be unfiltered
Some of the localrepo property caches must be computed unfiltered and
stored globally. Some others must see the filtered version and store data
relative to the current filtering.

This changeset introduces two classes `unfilteredpropertycache`
and `filteredpropertycache` for this purpose. A new function
`hasunfilteredcache` is introduced for unambiguous checking for cached
values on unfiltered repos.

A few tweaks are made to the property cache class to allow overriding
the way the computed value is stored on the object.

Some logic relative to _tagcaches is cleaned up in the process.
2012-10-08 20:02:20 +02:00
Pierre-Yves David
f922bebdae clfilter: use unfiltered repo for bookmark push logic
The remote location of the bookmark may be filtered locally. This
changeset ensures that bookmark movement logic has access to all the
repo's content.
2012-10-08 17:50:02 +02:00
Pierre-Yves David
d9bba16b21 clfilter: unfilter some parts of the push logic
Computation of common changesets during push needs to be done on the
widest set possible. An unfiltered version of the repo is kept for
discovery and various revset calls. The discovery code itself enforces
the filtering of unserved outgoing changeset.
2012-10-08 17:41:07 +02:00
Pierre-Yves David
a986d5d38d clfilter: ensure changeset creation in the repo is run unfiltered
This applies to both creation of new commits and application of
changegroups.
2012-11-26 19:24:11 +01:00
Pierre-Yves David
2fcc95d40f clfilter: ensure changegroup generation is run unfiltered
Changegroup generation logic needs to be aware of the whole repository
to work properly.
2012-11-26 19:23:25 +01:00
Pierre-Yves David
2f515d9fde clfilter: ensure rollback is run unfiltered
Rollback logic needs to be aware of the whole repository to work properly.
2012-11-26 19:21:24 +01:00
Pierre-Yves David
e0ecf6ce0b clfilter: ensure cache invalidation is done on the main unfiltered repo
The proxy version will not hold any cache for now. But we have to ensure
all cache operations are done on the unfiltered version.
2012-11-26 19:22:12 +01:00
Pierre-Yves David
e12b53d0bd clfilter: ensure that tag logic runs unfiltered
The current tag logic is not aware of filtering. We keep the status quo,
ensuring that the tag cache is computed as before: without any filtering.
2012-11-26 19:26:24 +01:00
Pierre-Yves David
bc880d748e clfilter: ensure branchcache logic runs unfiltered
The current branchcache construction is not aware of filtering. We keep
the status quo, ensuring that the branch cache logic is computed as
before: without any filtering.
2012-11-26 19:25:44 +01:00
Pierre-Yves David
edc0b7dbec clfilter: introduce an unfilteredmethod decorator
This decorator ensure the method in run on an unfiltered version of the
repository. See follow-up commit for details.

This decorator is not named `unfiltered` because it would clash with the
`unfilteredmethod` on `localrepo` itself.
2012-11-26 19:11:13 +01:00
Pierre-Yves David
8d8e5b22ad clfilter: introduce an "unfiltered" method on localrepo
This commit is part of the changelog level filtering effort. It returns
the main "unfiltered" version of a repo-like object. For localrepo this
means the same localrepo object. But this method will be overwritten
by the filtered versions of a repository to return the core unfiltered
version of the repo.

Introducing this simple method first allows later commits to prepare
for the use of a filtered version of a repository.

A new repo method is added because a lot of users may call it. At the
end of this series of commits, about 40 calls exist in core and hgext.
2012-11-21 00:36:29 +01:00
Augie Fackler
9766845689 bookmarks: introduce a bmstore to manage bookmark persistence
Bookmarks persistence still showed a fair amount of its legacy as a
monkeypatching extension. This encapsulates all bookmarks
serialization and parsing in a single class, and offers a single
location where other bookmarks storage engines can be substituted
in. As a result, many files no longer import the bookmarks module,
which strikes me as an encapsulation win.

This doesn't do anything to the current bookmark state yet, but I'm
hoping put that in the bmstore class as well.
2012-11-07 16:21:39 -06:00
Pierre-Yves David
42a23bce4e obsolete: add missing line feed in debug error message 2012-10-19 13:52:34 +02:00
Thomas Arendsen Hein
6e6ed4e398 localrepo: translate "push includes X changeset" only once
This was introduced in 72831ff4aa10
2012-10-23 09:22:46 +02:00
Pierre-Yves David
b3155544bd push: refuse to push bumped changeset
This applies the same logic as used for `obsolete` and `unstable` changesets.
Refuse to push them without force.

We'll probably want to factor this logic with two new functions
`pctx.troubled()` and `ctx.troubles()`. But I'm waiting for the third
"trouble" to make it into core.
2012-10-19 00:50:12 +02:00
push includes an xxx changeset: yyyyyyyyyy
8af08441ab obsolete: simplify push abort message
to:   push includes xxx changeset: yyyyyyyyyy
2012-10-19 00:46:39 +02:00
Kevin Bullock
13bf0fbbec scmutil: add bad character checking to checknewlabel
This factors out the checks from tags and bookmarks, and newly applies
the same prohibitions to branches. checknewlabel takes a new parameter,
kind, indicating the kind of label being checked.

Test coverage is added for all three types of labels.
2012-10-17 21:42:06 -05:00
Kevin Bullock
4abe92a68a tag: disallow '\0' in tag names
This brings the list of disallowed characters in line with bookmarks.
2012-10-17 21:39:07 -05:00
Tomasz Kleczek
8b2ac179dd branchcache: fetch source branchcache during clone (issue3378)
Recomputing branch cache on clone may be expensive,
therefore if possible we fetch it along with the data.

- If the clone is performed by copying, we just copy branchcache file.
- If we localrepo.clone and streaming then we follow the procedure:
  1. Fetch branchmap from the remote
  2. Fetch the actual data.
  3. Find the latest rev within branch heads (tip at the time of
     branchmap fetch)
  4. Update the cache for the revs in [remotetip+1, tip]

This way we ensure that the branchcache is correct even in case
of races with commits.
2012-10-03 13:19:53 -07:00
Pierre-Yves David
db63606246 hidden: remove tags use in hidden computation
Tags initially prevented revision to be hidden. It seemed a bad idea to have
tags refer to revisions that one can't see. But proper filtering of hidden
revisions excludes them from tag computation. Coming changelog filtering will do
that. Anyway, tags that really matter will likely be public and therefore not
hidden.

The current working directory parent and bookmarked revision are still not
hidden. Bookmarks were likely automatically moved at rewrite time, bookmarks
that remain on obsolete revisions were probably moved there on purpose.
2012-09-03 14:35:31 +02:00
Pierre-Yves David
3fc4db8ab5 clfilter: do not use tags cache if there are filtered changesets
If there are filtered changesets the cache is not valid. We'll have to cache
tags for filtered state too, but for now recomputing the tags is enough.
2012-09-03 14:35:05 +02:00
Pierre-Yves David
9ed771c48f clfilter: do not use branchmap cache if there are filtered changesets
If there are filtered changesets the cache is not valid. We'll have to cache
branchmap for filtered state too, but for now recomputing the branchmap is
enough.
2012-09-03 14:34:19 +02:00