Commit Graph

22369 Commits

Author SHA1 Message Date
Mads Kiilerich
a82df81b22 mq: make patchheader .plainmode more reliable
Instead of having to make extra checks whenever we use .plainmode, let the
initial value consider the actual patch header content.
2014-09-20 17:06:56 +02:00
Mike Hommey
518979521d bundle2: remove heads and common arguments to getbundle parts generators 2014-09-24 21:50:03 -07:00
Mike Hommey
4f54b8d62e bundle2: separate bundle10 and bundle2 cases in getbundle()
The primary goal is to make it easier for extensions to alter how bundle2
parts are laid out. They now can use the getbundle2partsgenerator decorator
to add new parts, or directly act on getbundle2partsmapping to wrap existing
part functions.

Note the 'request for bundle10 must include changegroup' error was kept
under the same conditions as before, although the logic changes don't make
it obvious.
2014-09-25 11:47:57 +09:00
Mike Hommey
8fdbd0d4df bundle2: pass b2caps down to functions adding bundle2 parts for getbundle 2014-09-25 11:11:37 +09:00
David Soria Parra
4a8632512f parsers: fix uninitialize variable warning
The heads pointer is not initialized correctly if filter is false, causing
both clang and gcc to issue a warning. Correctly initialize heads to NULL.
2014-09-24 13:16:20 -07:00
Pierre-Yves David
a7bd255d53 revset: use subset & in bare p2()
This takes advantage of the `fullreposet` smartness with a nice
speedup. It's a similar speedup to `p1()` when a merge is in progress
(the non merge case is already lightning fast anyway.)
2014-09-17 11:00:03 -07:00
Pierre-Yves David
85eb5c83a9 revset: use subset & in bare p1()
This takes advantage of the `fullreposet` smartness and yields a nice
speedup.

revset #0: p1()
0) wall 0.003256 comb 0.010000 user 0.010000 sys 0.000000 (best of 527)
1) wall 0.000066 comb 0.000000 user 0.000000 sys 0.000000 (best of 23224)
2014-09-17 10:59:52 -07:00
Pierre-Yves David
8cb4d64b32 revset: use subset & in rev
This takes advantage of the `fullreposet` smartness and yields a nice
speedup.

revset #0: rev(25)
0) wall 0.005480 comb 0.000000 user 0.000000 sys 0.000000 (best of 305)
1) wall 0.000052 comb 0.000000 user 0.000000 sys 0.000000 (best of 21891)
2014-09-17 11:00:09 -07:00
Pierre-Yves David
375f152fed revset: use subset & in origin
This takes advantage of the `fullreposet` smartness.

revset #0: origin(tip)
0) wall 0.005353 comb 0.000000 user 0.000000 sys 0.000000 (best of 354)
1) wall 0.003080 comb 0.000000 user 0.000000 sys 0.000000 (best of 446)
2014-09-17 19:52:34 -07:00
Pierre-Yves David
fe68969345 revset: use subset & in follow
This takes advantage of the `fullreposet` smartness.


revset #0: follow(COPYING)
0) wall 0.002446 comb 0.000000 user 0.000000 sys 0.000000 (best of 735)
1) wall 0.000331 comb 0.000000 user 0.000000 sys 0.000000 (best of 5672)
2014-09-17 10:59:16 -07:00
Pierre-Yves David
a3297e9a12 revset: use subset & in filelog
This takes advantage of the `fullreposet` smartness.

revset #0: file(COPYING)
0) wall 3.179066 comb 3.180000 user 3.140000 sys 0.040000 (best of 3)
1) wall 2.723699 comb 2.730000 user 2.690000 sys 0.040000 (best of 4)
2014-09-17 10:58:50 -07:00
Pierre-Yves David
244ffda42c revset: use subset & in divergent
This takes advantage of the `fullreposet` smartness.

revset #0: divergent()
0) wall 0.002047 comb 0.000000 user 0.000000 sys 0.000000 (best of 813)
1) wall 0.000052 comb 0.000000 user 0.000000 sys 0.000000 (best of 22757)
2014-09-17 10:58:39 -07:00
Pierre-Yves David
4cc5660e43 revset: use subset & in bisect
This takes advantage of the `fullreposet` smartness.

revset #0: bisect(range)
0) wall 0.014007 comb 0.010000 user 0.010000 sys 0.000000 (best of 115)
1) wall 0.005556 comb 0.010000 user 0.010000 sys 0.000000 (best of 235)
2014-09-17 10:57:57 -07:00
Pierre-Yves David
35c1eba9e6 revset: use subset & in ancestorspec
This takes advantage of the `fullreposet` smartness.


revset #0: tip~25
0) wall 0.004800 comb 0.010000 user 0.010000 sys 0.000000 (best of 259)
1) wall 0.002475 comb 0.000000 user 0.000000 sys 0.000000 (best of 717)
2014-09-17 10:57:47 -07:00
Pierre-Yves David
25b1e1b399 revset: use subset & in bookmark
Speedup, Weeeeeee!

revset #0: bookmark()
0) wall 0.002240 comb 0.000000 user 0.000000 sys 0.000000 (best of 571)
1) wall 0.000132 comb 0.000000 user 0.000000 sys 0.000000 (best of 14059)
2014-09-17 19:57:09 -07:00
Pierre-Yves David
cefa7eaabc revset: use subset & in outgoing
This should give us the same benefit as elsewhere. Result is simpler (and
"faster").

Outgoing is dominated by the discovery so no benchmark is provided.
2014-09-17 10:59:40 -07:00
Pierre-Yves David
490d3a84ce revset: avoid in loop lookup in _generatorset._consumegen
Python lookups are slow, so do all lookup outside of the for loop.

This provide a small but still significant speedup:

revset #0: 0::
0) wall 0.063258 comb 0.060000 user 0.060000 sys 0.000000 (best of 100)
1) wall 0.057776 comb 0.050000 user 0.050000 sys 0.000000 (best of 100)
2014-04-30 16:56:48 -07:00
Pierre-Yves David
ae357027fd revset: reduce dict lookup in lazyset.__contains__
Avoid an extra dict lookup when we have to compute the value. No
visible performance impact but this shaves the yak a few extra
nanometers.
2014-04-25 14:51:24 -07:00
Pierre-Yves David
e291b5bdba revset: do less lookup during spanset.__contains__
Attribute lookup is slow in python. So this version is going to be a bit
faster. This does not have a visible impact since the rest of the stack is much
slower but this shaves the yak a few extra nanometers.

Moreover the new version is more readable so it worth doing this change for code
quality purpose.

This optimisation was approved by a core python dev.
2014-04-25 17:53:58 -07:00
Martin von Zweigbergk
f89da734dc largefiles: simplify iteration over standins
Instead of iterating over all files in the context and ignoring those
that are not standins, pass a standin-matcher to the context and
iterate over only the files matching.

Apart from making the intent clearer, this implementation will also
benefit from any future optimizations done to the manifest walking
code.
2014-09-16 23:10:39 -07:00
Martin von Zweigbergk
aebcb29ce7 largefiles: avoid using 'lfiles' variable for two purposes
The variable 'lfiles' is first used for a set of the names of all the
large files. It is then overwritten with a tuple like the ones
returned from status(). To reduce confusion, let's create a separate
variable for the second use.
2014-09-16 22:50:38 -07:00
Martin von Zweigbergk
292e59117b largefiles: remove unnecessary clearing of status fields
At the end of lfilesrepo.status(), we clear the lists of unknown,
ignored and clean files, depending on the values of 'listunknown'
etc. The lists originate from other calls to status(), and it is only
'clean' that may get updated after the calls. Let's remove the need to
clear any of the lists by explicitly only adding to 'clean' when
'listclean' is true.
2014-09-22 13:05:36 -07:00
Mads Kiilerich
3057cb8243 mq: simplify patchheader handling of the empty line before the diff
Don't try to append empty lines to HG patch headers - instead, add them in str
method.

This minor change removes some apparently redundant code and makes the code
more robust.
2014-09-24 01:39:25 +02:00
Mads Kiilerich
600dadebda mq: write '# Parent ' lines with two spaces like export does (BC)
This aligns "Parent" node IDs with "Node ID" node IDs.
2014-09-24 01:36:44 +02:00
Mads Kiilerich
3ed8837146 mq: write headers for new HG patches in the same order as export (BC) 2014-09-20 17:06:56 +02:00
Mads Kiilerich
8c41a3576b mq: correctly make an empty line after description in new patches
There would in some cases be an empty line between headers and the description -
that does not seem right.

There should also be an empty line between description and diff - but that was
missing.

These two mistakes would sometimes make it up for each other so we fix both at
once to just show the improvement.

Instead of writing an extra newline when writing a header line, write an extra
line when it not is written as a part of the description but is necessary
anyway.
2014-09-20 17:06:56 +02:00
Martin von Zweigbergk
51a0933f38 largefiles: extract 'orig' method in reposetup.status 2014-09-16 14:51:56 -07:00
Martin von Zweigbergk
3121cae56f largefiles: extract 'orig' method in lfilesctx.filectx 2014-09-16 14:51:25 -07:00
Martin von Zweigbergk
03aa948230 largefiles: extract 'orig' method in lfilesmanifestdict.__contains__ 2014-09-16 14:50:38 -07:00
Martin von Zweigbergk
a0a60c4479 largefiles: reduce indentation by dropping 'else' block after 'return' 2014-09-16 14:40:25 -07:00
Martin von Zweigbergk
7eebfa3be1 largefiles: remove dead assignment left over from change 857b0706f1e5 2014-09-16 11:35:13 -07:00
Martin von Zweigbergk
998d55c67c match: simplify brittle predicate construction
In match.__init__(), we create the matchfn predicate by and-ing
together the individual predicates for includes, excludes (negated)
and patterns. Instead of the current set of nested if/else blocks, we
can simplify by adding the predicates to a list and defining the
overall predicate in a generic way based on the components. We can
still optimize it for the 0-length and 1-length cases. This way, there
is no combinatorial explosion to deal with if new component predicates
are added, and there is less risk of getting the overall predicate
wrong.
2014-09-19 13:49:58 -07:00
Siddharth Agarwal
f149aa54b6 convert: change default for git rename detection to 50%
This default mirrors the default for 'git diff'. Other commands have slightly
different defaults -- for example, the move/copy detection for 'git blame'
assumes that a hunk is moved if more than 40 alphanumeric characters are the
same, or copied if more than 20 alphanumeric characters are the same. 50% seems
to be the most common default, though.
2014-09-23 14:45:23 -07:00
Siddharth Agarwal
f28296d4ee convert: simplify git.similarity parsing 2014-09-23 14:40:32 -07:00
Pierre-Yves David
477ee214de revset: fast implementation for fullreposet.__and__
"And" operation with something that contains the whole repo should be super
cheap. Check method docstring for details.

This provide massive boost to simple revset that use `subset & xxx`

revset #0: p1(20000)
0) wall 0.002447 comb 0.010000 user 0.010000 sys 0.000000 (best of 767)
1) wall 0.000529 comb 0.000000 user 0.000000 sys 0.000000 (best of 3947)

revset #1: p2(10000)
0) wall 0.002464 comb 0.000000 user 0.000000 sys 0.000000 (best of 913)
1) wall 0.000530 comb 0.000000 user 0.000000 sys 0.000000 (best of 4226)

No other regression spotted.

More performance improvements are expected in the future as more
revset predicate are converted to use `subset & xxx`

The relaxed way `fullreposet` handles "&" operation may cause some trouble for
people comparing smartset from different filter levels. I'm not sure such people
exist and we can improve that aspect in later patches.
2014-09-24 20:11:36 -07:00
Pierre-Yves David
acb7d8cae1 revset: turn spanset into a factory function
We rename the `spanset` class to `_spanset`. `spanset` is now a function that
builds either a `fullreposet` or a `_spanset` according to the argument passed.

At some point, we may force people to explicitly use the `fullreposet`
constructor, but the current approach makes it easier to ensure we use the new
class whenever possible and focus on the benefits of this class.
2014-09-18 13:04:02 -07:00
Pierre-Yves David
8febe1e995 revert: add a fullreposet class
Every revset evaluation starts from `subset = spanset(repo)` and a lot of
revset predicates build a `spansetrepo` for their internal needs.

`spanset` is a generic class that can handle any situation. As a result a lot
of operation between spanset result in an `orderedlazyset`, a safe object but
suboptimal in may situation.

So we introduce a `fullreposet` class where some of the operation will be
overwritten to produce more interesting results.
2014-04-29 19:06:15 -07:00
Pierre-Yves David
5c32e2e043 obsolete: ensure that getrevs always return a set
When a set of revisions was empty, we were using an empty tuple. We now return an
empty frozenset to ensure the object could be used in an operation that requires a
set.
2014-09-23 12:21:38 -07:00
Matt Mackall
0e7a6163da merge with stable 2014-09-27 13:18:10 -05:00
Matt Mackall
b08b629028 merge with stable 2014-09-22 16:14:08 -05:00
Matt Mackall
4821ef7629 commands: deprecate the parents commands
It's replaced by 'hg summary' or hg log -r 'parents(foo)' and
doesn't need to take up space in our command list anymore.
2014-09-22 16:03:07 -05:00
Matt Mackall
2f833205d7 help: mention mode in hg log --removed help (issue4381) 2014-09-21 10:31:34 -05:00
Matt Mackall
4afe2f8b38 commit: catch changed exec bit on files from p1 (issue4382) 2014-09-21 10:07:06 -05:00
Pierre-Yves David
537742ab10 revset: remove nullrev from the bookmark computation
Same as for other revset we sanitize the content of the set to be able to rely
on it more.
2014-09-17 19:56:59 -07:00
Pierre-Yves David
a06107e4f9 revset: unify code flow in bookmark
We refactor the code of the bookmark revset to have a single return. This will
allow us to sanitize the content of the set.
2014-09-17 10:58:25 -07:00
Pierre-Yves David
9cdb9e5a5d revset: remove invalid value in the origin set
Same as the parents related revsets, origin had some invalid value in the
computed set. We remove them.
2014-09-17 10:59:30 -07:00
Pierre-Yves David
5005f69963 revset: remove nullrev from set computed in parents()
The old code relied on the subset contents to get rid of invalid values. We would
like to be able to rely more on the computation in parents() so we filter out
the invalid value.
2014-09-17 19:49:26 -07:00
Pierre-Yves David
1601426b0b revset: refactor parents() into a single return point
Both paths are doing similar thing in the end. We refactor the function so that
the `ps` set is commonly used at the end.

This will end excluding `nullrev` from this set in a future patch
2014-09-17 19:44:03 -07:00
Pierre-Yves David
3e189cc195 revset: remove nullrev from set computed in p1() and p2()
The old code relied on the subset contents to get rid of invalid values. We would
like to be able to rely more on the computation in p1() and p2() so we filter out
the invalid value
2014-09-17 04:40:30 -07:00
Pierre-Yves David
d0e7545de8 revset: add an optimised baseset.__contains__ (issue4371)
The baseset class is based on a python list. This means that base.__contains__
was absolutely as crappy as list.__contains__. We now rely on __contains__ from
the underlying set.

This will avoid having to explicitly convert the baseset to a set (using
baseset.set()) whenever one want fast membership test.

Apparently there is already code that forgot to do such conversions since we
observe a massive speedup in some test.

revset #25: roots((0::) - (0::tip))
0) wall 2.079454 comb 2.080000 user 2.080000 sys 0.000000 (best of 5)
1) wall 0.132970 comb 0.130000 user 0.130000 sys 0.000000 (best of 65)

No regression is observed in benchmarks.

This change improve the issue4371 back to acceptable situation (but are still
slower than manual substraction)
2014-09-16 23:59:29 -07:00