Commit Graph

22694 Commits

Author SHA1 Message Date
Pierre-Yves David
1ecbe47993 revset-children: remove usage of set()
All smartset classes have fast lookup, so this function will be removed soon.
2014-10-08 02:47:24 -07:00
Pierre-Yves David
4186e2d344 revset-branch: remove usage of set()
All smartset classes have fast lookup, so this function will be removed soon.
2014-10-08 02:47:00 -07:00
Pierre-Yves David
afe4b27987 revset-rangeset: remove usage of set()
All smartset classes have fast lookup, so this function will be removed soon.
2014-10-08 02:45:53 -07:00
Pierre-Yves David
ca06344dab revset-only: remove usage of set()
All smartset classes have fast lookup, so this function will be removed soon.
2014-10-08 02:45:43 -07:00
Pierre-Yves David
4e9488a8f8 revset: cache most conditions used in filter
Except when stated otherwise, the condition used in `smartset.filter` will be
cached. A new argument has been introduced to disable that behavior. We use it
for filters created from `and` and `sub` operations.

This gives massive performance boosts for revsets with expensive conditions.

revset: branch(stable) or branch(default)
before) wall 4.329070 comb 4.320000 user 4.310000 sys 0.010000 (best of 3)
after)  wall 2.356451 comb 2.360000 user 2.330000 sys 0.030000 (best of 4)

revset: author(mpm) or author(lmoscovicz)
before) wall 4.434719 comb 4.440000 user 4.440000 sys 0.000000 (best of 3)
after)  wall 2.321720 comb 2.320000 user 2.320000 sys 0.000000 (best of 4)
2014-10-09 22:57:52 -07:00
Pierre-Yves David
372cc7c36d baseset: empty or one-element sets are ascending and descending
The empty set is full of interesting properties. In the ordering case, the one
element set is too.
2014-10-09 04:12:20 -07:00
Pierre-Yves David
090fe27a36 filteredset: drop explicit order management
Now that all low-level smartset classes have proper ordering and fast iteration
management, we can just rely on the subset in filteredset.
2014-10-07 01:33:05 -07:00
Pierre-Yves David
d521f34fda revset: restore order of or operation as in Mercurial 2.9
Lazy revset broke the ordering of the `or` revset. We now stop assuming that
two ascending revset are combine into an ascending one.

Behavior in 3.0:

  3:4 or 2:5 == [2, 3, 4, 5]

Behavior in 2.9:

  3:4 or 2:5 == [3, 4, 2, 5]

We are adding a test for it.

For unclear reason, the performance `or` revset with expensive filter are
getting even worse than they used to be. This is probably caused by extra
uncached containment check or iteration.

revset #9: author(lmoscovicz) or author(mpm)
before) wall 3.487583 comb 3.490000 user 3.490000 sys 0.000000 (best of 3)
after)  wall 4.481486 comb 4.480000 user 4.470000 sys 0.010000 (best of 3)


revset #10: author(mpm) or author(lmoscovicz)
before) wall 3.164839 comb 3.170000 user 3.160000 sys 0.010000 (best of 3)
after)  wall 4.574965 comb 4.570000 user 4.570000 sys 0.000000 (best of 3)
2014-10-09 04:24:51 -07:00
Pierre-Yves David
2213bfcae4 revset-_descendant: rework the whole sorting and combining logic
We use the & operator to combine with subset (since this is more likely to be
optimised than filter) and we enforce the sorting of the result. Without this
enforced sorting, we may result in a different iteration order than the set
_descendent was computed from.

This reverts a bad `test-glog.t` change from 7904906883bd.

Another side effect is that `test-mq.t` shows `qparent::` including `-1` if
`qparent is -1`. This sound like a positive change.

This has good and bad impacts on the benchmarks, here is a good ones:

revset: 0::
before) wall 0.045489 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
after)  wall 0.034330 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)

revset: roots((0::) - (0::tip))
before)  wall 0.134090 comb 0.140000 user 0.140000 sys 0.000000 (best of 63)
after) wall 0.128346 comb 0.130000 user 0.130000 sys 0.000000 (best of 69)

revset: ::p1(p1(tip))::
before) wall 0.143892 comb 0.140000 user 0.140000 sys 0.000000 (best of 55)
after)  wall 0.124502 comb 0.130000 user 0.130000 sys 0.000000 (best of 65)

revset: roots((0:tip)::)
before) wall 0.204966 comb 0.200000 user 0.200000 sys 0.000000 (best of 43)
after) wall 0.184455 comb 0.180000 user 0.180000 sys 0.000000 (best of 47)

Here is a bad one:

revset: (20000::) - (20000)
before) wall 0.009592 comb 0.010000 user 0.010000 sys 0.000000 (best of 222)
after)  wall 0.029837 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)
2014-10-09 09:12:54 -07:00
Pierre-Yves David
b33f0a62a0 addset: do lazy sorting
The previous implementation was consuming the whole revset when asked for any
sort. The addset class is now doing lazy sorting like all other smarset classes.

This has no significant impact in the benchmark as-is. But this is important
to later change.
2014-10-09 20:15:41 -07:00
Pierre-Yves David
b47336fae5 test-import.t: use proper revset order
This test, written after 3.0, is relying on addset being enforced ascending if
both side are ascending. We are about to restore the ordering to 2.9 behavior
(elements are ordered in the order they are specified). We fix the test before
fixing the order.
2014-10-09 04:40:04 -07:00
Pierre-Yves David
cdcb3820d1 baseset: drop custom __sub__ method
This add method is enforcing non-laziness, disabling multiple optimisations.

Benchmarks do not spot any significant difference but real usecase may. This
will also be important for further improvements to addset later in this series.
2014-10-09 04:29:18 -07:00
Pierre-Yves David
32d4f6ce1e baseset: drop custom __and__ method
This add method is enforcing non-laziness, disabling multiple optimisations.

Benchmarks do not spot any significant regression but real usecase may. This
even gives some speedup in some cases:

revset #15: min(0::)
before) wall 0.001247 comb 0.000000 user 0.000000 sys 0.000000 (best of 1814)
after)  wall 0.000942 comb 0.000000 user 0.000000 sys 0.000000 (best of 2367)

This will also be important for further improvement to addset later in this series.
2014-10-09 04:27:25 -07:00
Pierre-Yves David
35f0c6215a baseset: drop custom __add__ method
This add method is enforcing non-laziness, disabling multiple optimisations.

Benchmarks do not spot any significant differences but real usecase may. This
will also be important for further improvements to addset later in this series.
2014-10-09 04:27:01 -07:00
Pierre-Yves David
52a52fdcdf obsolete: use format version 1 as the default for obsstore 2014-09-16 17:57:44 -07:00
Pierre-Yves David
8b312ba9ed test-obsolete: remove subminute timezone in test
Obsmarker format "1" does not supports sub minute timezone. So we change the
test to something slightly more sensible.
2014-09-16 19:13:08 -07:00
Pierre-Yves David
febcb6830b obsolete: add a "format.obsstore-version" config option
This option controls what version of the binary format to use when creating a new
obsstore file.

Default is still the old format. No safeguards are currently placed around the
option value, but no clueless users are in danger of harm since it is
undocumented.
2014-09-16 17:52:40 -07:00
Pierre-Yves David
3adb84204d obsolete: introduce a new binary encoding for obsmarkers (version 1)
This new encoding explicitly stores the date and parents allowing a
significantly faster marker decoding. See inline documentation for details.

This format is not yet used to store format on disk. But it will be used in
bundle2 exchange if both side support it. Support for on-disk format is coming
in other changesets.
2014-10-09 00:10:10 -07:00
Pierre-Yves David
2454012c73 obsstore: add a flag for sha256 hashes
We add flag to inform that the marker is using sha256 hashes. As format 0 is not
able to handle sha256 hashes (32 bytes long), we plain crash if we even attempt to
encode a sha256 with it.
2014-10-10 16:43:04 -05:00
Pierre-Yves David
6c00b7eafa obsolete: use uint## in the format documention
This is shorter and kind of more readable for people who care about binary
format.
2014-10-09 00:15:04 -07:00
Pierre-Yves David
7947a20614 obsolete: gather _fm0 meta encoding with other _fm0 code 2014-10-08 22:34:48 -07:00
Pierre-Yves David
db2b475090 obsolete: _rename decodemeta to _fm0decodemeta
This will be format zero specific.
2014-10-08 22:12:06 -07:00
Pierre-Yves David
67a3810eec obsolete: _rename encodemeta to _fm0encodemeta
This will be format zero specific.
2014-10-08 22:11:36 -07:00
Pierre-Yves David
d862c4a145 obsolete: store metadata as a tuple of (key, value) pairs (API)
Different formats will encode metadata in different ways. So we cannot keep the
binary blob in the object anymore. We use a tuple to ensure it is immutable and
hashable.
2014-10-08 22:10:15 -07:00
Matt Mackall
7e6c7ddb4e merge with stable 2014-10-10 12:15:46 -05:00
Matt Mackall
8090c41031 templater: fix ifcontains when list is a string (issue4399) 2014-10-10 11:38:00 -05:00
Martin von Zweigbergk
545877b86f merge: make error message consistent with other commands
If a merge is attempted when another merge is already ongoing, we give
the message "outstanding uncommitted merges". Many other commands
(such as backout, rebase, histedit) give the same message in singular
form. Since the singular form also seems to make more sense, let's use
that for 'hg merge' as well.
2014-10-08 14:16:53 -07:00
Augie Fackler
a90f2cdd55 test-run-tests: add a test for detection of failure to start a server
This also highlights a bug: right now we print "2 failed" but we only
ran one test.
2014-10-10 10:34:52 -04:00
Kyle Lippincott
95982a95be run-tests: more accurate/helpful message than "diff generation failed"
Diff generation didn't really fail, it recognized that an hg serve server has
failed to start, and thus skipped the diff generation intentionally.

The most common reason for a server to fail to start is that the port was
already in use, so output HGPORT as well, to help finding it (since pgrep -f
'hg serve' is not sufficient, if the command line is something like 'hg -R main
serve')
2014-10-09 17:00:29 -07:00
Augie Fackler
dcb03fe445 run-tests: handle --jobs and --first gracefully
Without this change, --first causes currently-running tests to explode
in violent and surprising ways when their temporary directory gets
cleaned up. Now we just suppress failure messages from non-first
failures when running in --first mode.
2014-10-09 15:10:40 -04:00
Jordi Gutiérrez Hermoso
e02b19218d shelve: don't delete "." when rebase is a no-op (issue4398)
When unshelving and facing a conflict, if we resolve all conflicts in
favour of the committed changes instead of the shelved changes, then
the ensuing implicit rebase is a no-op. That is, there is nothing to
rebase. In this case, there are no extra intermediate shelve commits
to strip either. Prior to this change, the commit being unshelved to
would be marked for destruction in a rather catastrophic way.

The relevant part of the test case failed as follows:

    $ hg unshelve -c
    unshelve of 'default' complete
    $ hg diff
    warning: ignoring unknown working parent 33f7f61e6c5e!
    diff --git a/a/a b/a/a
    new file mode 100644
    --- /dev/null
           b/a/a
    @@ -0,0   1,3 @@
      a
      c
      x
    $ hg status
    warning: ignoring unknown working parent 33f7f61e6c5e!
    M a/a
    ? a/a.orig
    ? foo/foo
    $ hg summary
    warning: ignoring unknown working parent 33f7f61e6c5e!
    parent: -1:000000000000  (no revision checked out)
    branch: default
    commit: 1 modified, 2 unknown (new branch head)
    update: 4 new changesets (update)

With this change, this test case now passes.
2014-10-08 07:47:11 -04:00
Jordi Gutiérrez Hermoso
c978db634c config: use the same hgrc for a cloned repo as for an uninitted repo
This just copies the same local sample hgrc, except it sets the
default path to the repo it was cloned from.

This is cut-and-paste from the local sample hgrc, but I think it's
acceptable, since the two pieces of code are right next to each other
and they're small. There is danger of them going out of synch, but it
would complicate the code too much to get rid of this C&P.

I also add ui as an import to hg.py, but with demandimport, this
should not be a noticeable performance hit.
2014-10-06 16:35:02 -04:00
Jordi Gutiérrez Hermoso
e296a9f550 config: give a more detailed sample repo config
Some examples of the typical configurations that one might want to do
in an .hg/hgrc file. This includes a default-push that happens to
point to the same location as my-fork.

I insist on the myfork terminology for a server-side clone. Bitbucket,
Github, and others have widely popularised this meaning of "fork".

This also includes a gentle nudge to use a repo-specific username,
which is something that people might not instinctively realise is an
option.
2014-10-08 07:45:51 -04:00
Pierre-Yves David
89697960fb smartset: drop infamous ascending, descending
All your friends are dead.
2014-10-07 01:46:53 -07:00
Pierre-Yves David
1f08d3a119 fullreposet: use isascending instead of ascending to recognise smartsets
`ascending` is going to be removed.
2014-10-07 01:41:14 -07:00
Pierre-Yves David
6da3ca17ab fullreposet: use sort to enforce the order
The `ascending` and `descending` methods are useless.
2014-10-07 01:41:26 -07:00
Pierre-Yves David
40789b5325 revancestors: replace descending with sort(reverse=False) 2014-10-07 01:48:34 -07:00
Pierre-Yves David
9ae79aaf3a _descendants: replace ascending() with sort() 2014-10-07 01:41:02 -07:00
Pierre-Yves David
59a9933f96 _descendants: directly use smartset
As `addset` objects are proper smartset objects, we do not need to make any
transformation of the result.
2014-10-07 01:36:53 -07:00
Pierre-Yves David
eb55591aca baseset: explicitly track order of the baseset
A baseset starts without an explicit order. But as soon as a sort is requested,
we simply register that the baseset has an order and use the ordered version of
the list to behave accordingly.

We will want to properly record the order at creation time in the future. This
would unlock more optimisation and avoid some sorting.
2014-10-03 03:29:55 -05:00
Pierre-Yves David
cf7077b249 baseset: fix isascending and isdescending
We now have sufficient information to return the proper value there.
2014-10-03 03:31:05 -05:00
Pierre-Yves David
ff023f566d baseset: prepare lazy ordering in __iter__
We'll explicitly track the order of the baseset to take advantage of the
ascending and descending lists during iteration.
2014-10-03 03:26:18 -05:00
Pierre-Yves David
d2f9fa68fe baseset: implement a fastasc and fastdesc
Baseset contains already-computed revisions. It is considered "cheap" to do
operations on an already-computed set. So we add attributes to hold version of
the list in ascending and descending order and use them for `fastasc` and
`fastdesc`. Having distinct lists is important to provide correct iteration in
all cases. Altering a python list will impact an iterator connected to it.

eg: not preserving order at iterator creation time

    >>> l = [0, 1]
    >>> i = iter(l)
    >>> l.reverse()
    >>> list(i)
    [1, 0]

eg: corrupting in progress iteration

    >>> l = [0, 1]
    >>> i = iter(l)
    >>> i.next()
    0
    >>> l.reverse()
    >>> i.next()
    0
2014-10-03 03:19:23 -05:00
Pierre-Yves David
b09ad7ecb4 baseset: stop inheriting from built-in list class
The baseset is doing more and more smartset magic and using its list-like
property less and less. So we store the list of revisions in an explicit
attribute and stop inheriting.

This requires reimplementing some basic methods.
2014-10-06 11:03:30 -07:00
Pierre-Yves David
acbd681281 strip: stop calling remove on smartset
The `remove` method is not part of the smartset specification. We use a plain
old list comprehension instead.
2014-10-07 00:38:14 -07:00
Pierre-Yves David
24a85b292d rebase: transform the smartset to a list before comparing with a list
This is highly suboptimal but smartsets are not comparable to lists yet.
2014-10-07 00:31:53 -07:00
Pierre-Yves David
04745ea203 merge.update: use first instead of direct indexing
This makes it compatible with all smartset classes.
2014-10-07 00:41:58 -07:00
Pierre-Yves David
916745c92f qimport: use first and last instead of direct indexing
This makes it compatible with all smartset classes.
2014-10-07 00:33:47 -07:00
Pierre-Yves David
f0eddcafaf rebase: use last instead of direct indexing
This makes it compatible with all smartset classes.
2014-10-07 00:16:59 -07:00
Pierre-Yves David
ecd6c596c3 mq: use last instead of direct indexing
This makes it compatible with all smartset classes.
2014-10-07 00:14:53 -07:00