Mercurial > hg
annotate tests/test-simple-update.t @ 52060:8b7123c8947b
update: add a Rust fast-path when updating from null (and clean)
This case is easy to detect and we have all we need to generate a valid
working copy and dirstate entirely in Rust, which speeds things up
considerably:
On my machine updating a repo of ~300k files goes from 10.00s down to 4.2s,
all while consuming 50% less system time, with all caches hot.
Something to note is that further improvements will probably happen
with the upcoming `InnerRevlog` series that does smarter
mmap hanlding, especially for filelogs.
Here are benchmark numbers on a machine with only 4 cores (and no SMT enabled)
```
### data-env-vars.name = heptapod-public-2024-03-25-ds2-pnm
# benchmark.name = hg.command.update
# bin-env-vars.hg.py-re2-module = default
# bin-env-vars.hg.changeset.node = <this change>
# benchmark.variants.atomic-update = no
# benchmark.variants.scenario = null-to-tip
# benchmark.variants.worker = default
default: 5.328762 ~~~~~
rust: 1.308654 (-75.44%, -4.02)
### data-env-vars.name = mercurial-devel-2024-03-22-ds2-pnm
# benchmark.name = hg.command.update
# bin-env-vars.hg.py-re2-module = default
# bin-env-vars.hg.changeset.node = <this change>
# benchmark.variants.atomic-update = no
# benchmark.variants.scenario = null-to-tip
# benchmark.variants.worker = default
default: 1.693271 ~~~~~
rust: 1.151053 (-32.02%, -0.54)
### data-env-vars.name = mozilla-unified-2024-03-22-ds2-pnm
# benchmark.name = hg.command.update
# bin-env-vars.hg.py-re2-module = default
# bin-env-vars.hg.changeset.node = <this change>
# benchmark.variants.atomic-update = no
# benchmark.variants.scenario = null-to-tip
# benchmark.variants.worker = default
default: 38.901613 ~~~~~
rust: 11.637880 (-70.08%, -27.26)
### data-env-vars.name = netbsd-xsrc-public-2024-09-19-ds2-pnm
# benchmark.name = hg.command.update
# bin-env-vars.hg.py-re2-module = default
# bin-env-vars.hg.changeset.node = <this change>
# benchmark.variants.atomic-update = no
# benchmark.variants.scenario = null-to-tip
# benchmark.variants.worker = default
default: 4.793727 ~~~~~
rust: 1.505905 (-68.59%, -3.29)
```
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 01 Oct 2024 13:49:11 +0200 |
parents | 2f2682f40ea0 |
children |
rev | line source |
---|---|
13956
ffb5c09ba822
tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents:
12365
diff
changeset
|
1 $ hg init test |
12279 | 2 $ cd test |
3 $ echo foo>foo | |
4 $ hg addremove | |
5 adding foo | |
6 $ hg commit -m "1" | |
331 | 7 |
49825
2f2682f40ea0
tests: use the `--quiet` flag for verify when applicable
Raphaël Gomès <rgomes@octobus.net>
parents:
45827
diff
changeset
|
8 $ hg verify -q |
12279 | 9 |
10 $ hg clone . ../branch | |
11 updating to branch default | |
12 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
13 $ cd ../branch | |
14 $ hg co | |
15 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
16 $ echo bar>>foo | |
45456
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
17 $ hg commit -m "2" -d '1 0' |
331 | 18 |
12279 | 19 $ cd ../test |
20 | |
21 $ hg pull ../branch | |
22 pulling from ../branch | |
23 searching for changes | |
24 adding changesets | |
25 adding manifests | |
26 adding file changes | |
27 added 1 changesets with 1 changes to 1 files | |
45456
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
28 new changesets 84b9316f7b31 |
38250
d0abd7949ea3
phases: use "published" in the phase movement message
Boris Feld <boris.feld@octobus.net>
parents:
38249
diff
changeset
|
29 1 local changesets published |
12279 | 30 (run 'hg update' to get a working copy) |
331 | 31 |
49825
2f2682f40ea0
tests: use the `--quiet` flag for verify when applicable
Raphaël Gomès <rgomes@octobus.net>
parents:
45827
diff
changeset
|
32 $ hg verify -q |
12279 | 33 |
34 $ hg co | |
35 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
36 | |
37 $ cat foo | |
38 foo | |
39 bar | |
40 | |
41 $ hg manifest --debug | |
42 6f4310b00b9a147241b071a60c28a650827fb03d 644 foo | |
43 | |
13960
190e5f2043d9
update: fix check for no rev when a date is given
Idan Kamara <idankk86@gmail.com>
parents:
13956
diff
changeset
|
44 update to rev 0 with a date |
190e5f2043d9
update: fix check for no rev when a date is given
Idan Kamara <idankk86@gmail.com>
parents:
13956
diff
changeset
|
45 |
190e5f2043d9
update: fix check for no rev when a date is given
Idan Kamara <idankk86@gmail.com>
parents:
13956
diff
changeset
|
46 $ hg upd -d foo 0 |
190e5f2043d9
update: fix check for no rev when a date is given
Idan Kamara <idankk86@gmail.com>
parents:
13956
diff
changeset
|
47 abort: you can't specify a revision and a date |
45827
8d72e29ad1e0
errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents:
45456
diff
changeset
|
48 [10] |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
13960
diff
changeset
|
49 |
45456
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
50 update by date |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
51 |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
52 $ hg update -d '<1970-01-01 00:00:02 +0000' |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
53 found revision 1 from Thu Jan 01 00:00:01 1970 +0000 |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
54 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
55 $ hg update -d '<1970-01-01 00:00:01 +0000' |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
56 found revision 1 from Thu Jan 01 00:00:01 1970 +0000 |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
57 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
58 $ hg update -d '<1970-01-01 00:00:00 +0000' |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
59 found revision 0 from Thu Jan 01 00:00:00 1970 +0000 |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
60 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
61 |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
62 $ hg update -d '>1970-01-01 00:00:02 +0000' |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
63 abort: revision matching date not found |
45827
8d72e29ad1e0
errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents:
45456
diff
changeset
|
64 [10] |
45456
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
65 $ hg update -d '>1970-01-01 00:00:01 +0000' |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
66 found revision 1 from Thu Jan 01 00:00:01 1970 +0000 |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
67 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
68 $ hg update -d '>1970-01-01 00:00:00 +0000' |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
69 found revision 1 from Thu Jan 01 00:00:01 1970 +0000 |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
70 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
71 |
41020
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
72 update to default destination (with empty revspec) |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
73 |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
74 $ hg update -q null |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
75 $ hg update |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
76 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
77 $ hg id |
45456
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
78 84b9316f7b31 tip |
41020
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
79 |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
80 $ hg update -q null |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
81 $ hg update -r '' |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
83 $ hg id |
45456
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
84 84b9316f7b31 tip |
41020
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
85 |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
86 $ hg update -q null |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
87 $ hg update '' |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
88 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
89 $ hg id |
45456
65960fe9a769
test-simple-update: add test for -d DATE option
Yuya Nishihara <yuya@tcha.org>
parents:
42522
diff
changeset
|
90 84b9316f7b31 tip |
41020
fbd5e2f0bba7
update: do not pass in user revspec as default destination (issue6044)
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
91 |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
13960
diff
changeset
|
92 $ cd .. |
31117
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
93 |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
94 update with worker processes |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
95 |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
96 #if no-windows |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
97 |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
98 $ cat <<EOF > forceworker.py |
52060
8b7123c8947b
update: add a Rust fast-path when updating from null (and clean)
Raphaël Gomès <rgomes@octobus.net>
parents:
49825
diff
changeset
|
99 > from mercurial import extensions, merge, worker |
38731
ef3838a47503
worker: ability to disable thread unsafe tasks
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38250
diff
changeset
|
100 > def nocost(orig, ui, costperop, nops, threadsafe=True): |
31117
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
101 > return worker._numworkers(ui) > 1 |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
102 > def uisetup(ui): |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
103 > extensions.wrapfunction(worker, 'worthwhile', nocost) |
52060
8b7123c8947b
update: add a Rust fast-path when updating from null (and clean)
Raphaël Gomès <rgomes@octobus.net>
parents:
49825
diff
changeset
|
104 > merge.MAYBE_USE_RUST_UPDATE = False |
31117
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
105 > EOF |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
106 |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
107 $ hg init worker |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
108 $ cd worker |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
109 $ cat <<EOF >> .hg/hgrc |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
110 > [extensions] |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
111 > forceworker = $TESTTMP/forceworker.py |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
112 > [worker] |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
113 > numcpus = 4 |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
114 > EOF |
39707
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
39489
diff
changeset
|
115 $ for i in `"$PYTHON" $TESTDIR/seq.py 1 100`; do |
31117
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
116 > echo $i > $i |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
117 > done |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
118 $ hg ci -qAm 'add 100 files' |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
119 |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
120 $ hg update null |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
121 0 files updated, 0 files merged, 100 files removed, 0 files unresolved |
31118
a91c62752d08
worker: flush messages written by child processes before exit
Yuya Nishihara <yuya@tcha.org>
parents:
31117
diff
changeset
|
122 $ hg update -v | grep 100 |
a91c62752d08
worker: flush messages written by child processes before exit
Yuya Nishihara <yuya@tcha.org>
parents:
31117
diff
changeset
|
123 getting 100 |
31117
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
124 100 files updated, 0 files merged, 0 files removed, 0 files unresolved |
42521
64a873ca7135
tests: show bug in update introduced in 87a34c767384
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
41020
diff
changeset
|
125 $ hg status |
31117
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
126 |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
127 $ cd .. |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
128 |
92bca12328d1
worker: add basic test to ensure child processes are managed well
Yuya Nishihara <yuya@tcha.org>
parents:
16913
diff
changeset
|
129 #endif |