Commit Graph

9425 Commits

Author SHA1 Message Date
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
7ce187106f clfilter: bookmark.validdest should run on unfiltered repo
The logic recently added to `bookmark.validdest` uses data about obsolete
changesets to see if a bookmark destination is valid. Obsolete changesets
are likely to be filtered, so we need to work on an unfiltered repository.
2012-10-08 17:26:23 +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
c2a31b5437 clfilter: prevent unwanted warning about filtered parents as unknown
During changectx __init__ the dirstate's parents MAY be checked. If
the repo is filtered, this check will complain "working directory has
unknown parents" even if the parents are perfectly known.

This may happen when the repo is used for serving and the dirstate has
parents that are secret, as those secret changesets will be filtered.
2012-10-08 17:15:08 +02:00
Pierre-Yves David
d646efae02 clfilter: strip logic should be unfiltered
Strip is a "write" operation that needs to be aware of the whole repo's
content before destroying changesets.

Only the low level function is altered. The top level command will still
process its argument filtered (if any filtering is in place).
2012-10-08 17:12:09 +02:00
Pierre-Yves David
a39281497e clfilter: verify logic should be unfiltered
To verify a changelog obviously needs all of it. The verify logic now
ensures it works on an unfiltered repository.
2012-10-08 17:08:52 +02: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
Pierre-Yves David
4abb88cb7f clfilter: unfilter computation of obsolescence related computation
All obsolescence related sets need to be computed on the full unfiltered
version of the repository, in particular because several of them
(obsolete, extinct) are used to compute the hidden revisions.

On a filtered repo, revset predicates related to these sets will be
properly filtered because of revset's own pre-filtering.
2012-10-08 16:55:00 +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
Pierre-Yves David
8bebd5c244 clfilter: remove usage of range and xrange in scmutil.revrange
For changelog level filtering to take effect it need to be used for any
iteration.

This changeset removes usage of `range` and `xrange` that survived the first
pass.
2012-11-20 19:05:46 +01:00
Weiwen
64b5450a1f hgweb: display diff for a changeset against any parents (issue2810)
During merge of branches, it is useful to compare merge results against
the two parents.  This change adds this support to hgweb.  To specify
which parent to compare to, use rev/12300:12345 where 12300 is a
parent changeset number.  Two links are added to changeset web page so
that one can choose which parent to compare to.
2012-11-12 14:05:39 -08:00
Tim Henigan
f99bb85c98 branch: add missing repo argument to checknewlabel
scmutil.checknewlabel takes a repo object as its first argument.
When the call to this function was added in 4d438984605c, the
first argument was mistakenly set to 'None'.
2012-11-29 08:49:21 -05:00
Tim Henigan
e6d3f7258f dirstate: remove obsolete comment from setbranch
This comment should have been removed in 4d438984605c, when the call
to scmutil.checknewlabel was removed.
2012-11-29 08:44:54 -05:00
Matt Mackall
8b3d6f35a8 merge with stable 2012-11-28 18:08:51 -06:00
Tim Henigan
68a1fc4488 update: allow update to existing branches with invalid names (issue3710)
Starting with 049792af94d6, users are no longer able to update a
working copy to a branch named with a "bad" character (such as ':').

Prior to v2.4, it was possible to create branch names using "bad"
characters, so this breaks backwards compatibility.

Mercurial must allow users to update to existing branches with bad
names.  However, it should continue to prevent the creation of new
branches with bad names.

A test was added to confirm that 'hg update' works as expected. The
test uses a bundled repo that was created with an earlier version of
Mercurial.
2012-11-27 08:47:35 -05:00
Pierre-Yves David
292c83cd65 command: remove phase from the list of basic command
This is not a basic command. There is no reason new user should needs to know
about it. Thanks to Matt Mackall for pointing this.
2012-11-28 11:20:56 +01:00
André Sintzoff
94ef5e50d6 phases: fix missing "error" module import (issue3707) 2012-11-25 20:39:37 +01:00
Matt Mackall
1c34c93b25 hooks: be even more forgiven of non-fd descriptors (issue3711)
Looks like there are instances where sys.stdout/stderr contain file
handles that are invalid. We should be tolerant of this for hook I/O
redirection, as our primary concern is not garbling our own output stream.
2012-11-26 17:48:39 -06:00
Matt Mackall
c6fe65e9e2 hooks: delay I/O redirection until we actually run a hook (issue3711)
We were attempting to redirect I/O even if no hook was actually
getting called. This defers redirection until we've found something to
do.
2012-11-26 16:14:22 -06:00
Matt Mackall
af5b4b62cf util: make chunkbuffer non-quadratic on Windows
The old str-based += collector performed very nicely on Linux, but
turns out to be quadratically expensive on Windows, causing
chunkbuffer to dominate in profiles.

This list-based version has been measured to significantly improve
performance with large chunks on Windows, with negligible overall
overhead on Linux (though microbenchmarks show it to be about 50% slower).

This may increase memory overhead where += didn't behave quadratically. If we
want to gather up 1G of data to join, we temporarily have 1G in our
list and 1G in our string.
2012-11-26 15:42:52 -06:00
Matt Mackall
d4deebc4f7 revset: backed out changeset 7a8dc9a35aa2
This was causing clones of the hg repo to go from 12.4s to 14.7s.
2012-11-26 13:44:11 -06:00
Durham Goode
d2d598be6c commit: increase perf by building a new addlist instead of editing the old one
When commiting to a repo with lots of files (>170000),
manifest.py:addlistdelta takes some time because it's editing a large
array many times. Changing it to build a new array instead of editing
the old one saves around 0.04 seconds on a 1.64 second commit. A 2.5%
gain.

The gain here is pretty minor, but it was blatantly at the top of the
profiler report and the fix is straight forward.

I tested it by comparing the arrays produced by the new and old logic
while running all of the tests.
2012-11-19 16:05:40 -08:00
Weiwen
75df7d78cd template engine: convert generator-based iterator to list-based iterator
If a template iterator is implemented with generator, the iterator is exhau=
sted
after we use it.  This leads to undesired behavior in template.  This chang=
e
converts a generator-based iterator to list-based iterator when template en=
gine
first detects a generator-based iterator.  All future usages of iterator wi=
ll
use list instead.
2012-11-28 14:55:42 -08:00
Matt Mackall
cf4605492a merge with stable 2012-11-28 16:15:05 -06:00
Durham Goode
6a6b8c49d1 commit: increase perf by avoiding checks against entire repo subsets
When commiting to a repo with lots of history (>400000 changesets)
checking the results of revset.py:descendants against the subset takes
some time.  Since the subset equals the entire changelog, the check
isn't necessary.  Avoiding it in that case saves 0.1 seconds off of
a 1.78 second commit. A 6% gain.

We use the length of the subset to determine if it is the entire repo.
There is precedence for this in revset.py:stringset.
2012-11-16 15:39:12 -08:00
Durham Goode
cce0517fb6 commit: increase perf by avoiding unnecessary filteredrevs check
When commiting to a repo with lots of history (>400000 changesets)
the filteredrevs check (added with 373606589de5) in changelog.py
takes a bit of time even if the filteredrevs set is empty. Skipping
the check in that case shaves 0.36 seconds off a 2.14 second commit.
A 17% gain.
2012-11-16 15:39:12 -08:00
Kevin Bullock
b676337ab7 grep: remove useless while condition
A revised version of 51ea4dcf1448 was sent to the list that fixed this
<http://markmail.org/message/jmfuiise5igcyh2m>, but the older version of
the patch was applied.
2012-11-15 11:27:30 -06:00
Idan Kamara
4ae64fdb03 grep: don't search past the end of the searched string
'*' causes the resulting RE to match 0 or more repetitions of the preceding RE:

>>> bool(re.search('.*', ''))
>>> True

This causes an infinite loop because currently we're only checking if there was
a match without looking at where we are in the searched string.
2012-11-12 19:27:03 +02:00
Pierre-Yves David
cc961a38fb amend: force editor only if old message is reused (issue3698)
This regression was added by 435d13b1e757. It triggered the editor even if
--message or --logfile were provided.
2012-11-13 08:41:56 -08:00
Siddharth Agarwal
de26481ded ancestor: fix a comment (followup to 17e6f4c8dcfb) 2012-11-28 10:35:12 -08:00
Pierre-Yves David
9ac120f569 revlog: allow reverse iteration with revlog.revs
We often need to perform rev iteration in reverse order. This
changeset makes it possible to do so, in order to avoid costly reverse
or reversed() calls later.
2012-11-21 00:42:05 +01:00
Siddharth Agarwal
b05b94a300 revlog: add rev-specific variant of findmissing
This will be used by rebase in an upcoming commit.
2012-11-26 10:48:24 -08:00
Siddharth Agarwal
76a23a18f8 revlog: switch findmissing to use ancestor.missingancestors
This also speeds up other commands that use findmissing, like
incoming and merge --preview. With a large linear repository (>400000
commits) and with one incoming changeset, incoming is sped up from
around 4-4.5 seconds to under 3.
2012-11-26 11:02:48 -08:00
Siddharth Agarwal
a0694d4a53 ancestor: faster algorithm for difference of ancestor sets
One of the major reasons rebase is slow in large repositories is
the computation of the detach set: the set of ancestors of the
changesets to rebase not in the destination parent. This is currently
done via a revset that does two walks all the way to the root of
the DAG. Instead of doing that, to find ancestors of a set <revs>
not in another set <common> we walk up the tree in reverse revision
number order, maintaining sets of nodes visited from <revs>, <common>
or both.

For the common case where the sets are close both topologically and
in revision number (relative to repository size), this has been
found to speed up rebase by around 15-20%. When the nodes are farther
apart and the DAG is highly branching, it is harder to say which
would win.

Here's how long computing the detach set takes in a linear repository
with over 400000 changesets, rebasing near tip:

Rebasing across 4 changesets
Revset method: 2.2s
New algorithm: 0.00015s

Rebasing across 250 changesets
Revset method: 2.2s
New algorithm: 0.00069s

Rebasing across 10000 changesets
Revset method: 2.4s
New algorithm: 0.019s
2012-11-26 11:46:51 -08:00
Jordi Gutiérrez Hermoso
022cc130e9 bisect: add example for limiting bisection to specified directories
The bisect command does not have an option to limit itself only to
subdirectories, but it's possible to use revsets for the --skip option
for the same effect. Given the relative obscurity of revsets, it helps
to have this as another example for bisect.
2012-11-23 11:59:44 -05:00
Bryan O'Sullivan
0dc2115da0 subrepo: use posixpath when diffing, for consistent paths
This fixes a Windows failure in test-subrepo-recursion.t introduced
by c9345d017402.
2012-11-27 14:58:00 -08:00
Adrian Buehlmann
b5e726b312 openpath: specify binary mode and use util.posixfile
follow-up to aa655773f574
2012-11-01 13:46:03 +01:00
Simon Heimberg
b731b379ec subrepo: only do clean update when overwrite is set (issue3276)
Files in a subrepo were overwritten on update. But this should only happen on a
clean update (example: -C is specified).
Use the overwrite parameter introduced for svn subrepos in e3640daa4703 to
decide whether to merge changes (as update) or remove them (as clean).

The new function hg.updaterepo is intruduced to keep all update calls in hg.

test-subrepo.t is extended to test if an untracked file is overwritten
(issue3276). (Update -C is already tested in many places.)
The first two chunks are debugging output which has changed. (Because overwrite
is not always true anymore for subrepos)
All other tests still pass without any change.
2012-10-24 18:45:22 +02:00
FUJIWARA Katsunori
f05ff4243c i18n: add "i18n" comment to column positioning messages of "hg summary"
This comment makes it easier to distinguish such messages from others
for message translators.
2012-10-31 03:59:28 +09:00
FUJIWARA Katsunori
ff00b9869d i18n: add "i18n" comment to column positioning messages of "hg log"
This comment makes it easier to distinguish such messages from others
for message translators.
2012-10-31 03:59:27 +09:00
FUJIWARA Katsunori
78e9fa90ae i18n: add "i18n" comment to error messages of template functions 2012-10-31 03:59:27 +09:00
FUJIWARA Katsunori
2cf8855a64 icasefs: make case-folding collision detection as deletion aware (issue3648)
Before this patch, case-folding collision is checked simply between
manifests of each merged revisions.

So, files may be considered as colliding each other, even though one
of them is already deleted on one of merged branches: in such case,
merge causes deleting it, so case-folding collision doesn't occur.

This patch checks whether both of files colliding each other still
remain after merge or not, and ignores collision if at least one of
them is deleted by merge.

In the case that one of colliding files is deleted on one of merged
branches and changed on another, file is considered to still remain
after merge, even though it may be deleted by merge, if "deleting" of
it is chosen in "manifestmerge()".

This avoids fail to merge by case-folding collisions after choices
from "changing" and "deleting" of files.

This patch adds only tests for "removed remotely" code paths in
"_remains()", because other ones are tested by existing tests in
"test-casecollision-merge.t".
2012-10-31 16:50:22 +09:00