Mercurial > hg
annotate tests/test-addremove-similar.t @ 24787:9d5c27890790
largefiles: for update -C, only update largefiles when necessary
Before, a --clean update with largefiles would use the "optimization" that it
didn't read hashes from standin files before and after the update. Instead of
trusting the content of the standin files, it would rehash all the actual
largefiles that lfdirstate reported clean and update the standins that didn't
have the expected content. It could thus in some "impossible" situations
automatically recover from some "largefile got out sync with its standin"
issues (even there apparently still were weird corner cases where it could
fail). This extra checking is similar to what core --clean intentionally do
not do, and it made update --clean unbearable slow.
Usually in core Mercurial, --clean will rely on the dirstate to find the files
it should update. (It is thus intentionally possible (when trying to trick the
system or if there should be bugs) to end up in situations where --clean not
will restore the working directory content correctly.) Checking every file when
we "know" it is ok is however not an option - that would be too slow.
Instead, trust the content of the standin files. Use the same logic for --clean
as for linear updates and trust the dirstate and that our "logic" will keep
them in sync. It is much cheaper to just rehash the largefiles reported dirty
by a status walk and read all standins than to hash largefiles.
Most of the changes are just a change of indentation now when the different
kinds of updates no longer are handled that differently. Standins for added
files are however only written when doing a normal update, while deleted and
removed files only will be updated for --clean updates.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 15 Apr 2015 15:22:16 -0400 |
parents | 94091ab9d112 |
children | 56b2bcea2529 |
rev | line source |
---|---|
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
1 $ hg init rep; cd rep |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
2 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
3 $ touch empty-file |
22947
c63a09b6b337
tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents:
16913
diff
changeset
|
4 $ $PYTHON -c 'for x in range(10000): print x' > large-file |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
5 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
6 $ hg addremove |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
7 adding empty-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
8 adding large-file |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
9 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
10 $ hg commit -m A |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
11 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
12 $ rm large-file empty-file |
22947
c63a09b6b337
tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents:
16913
diff
changeset
|
13 $ $PYTHON -c 'for x in range(10,10000): print x' > another-file |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
14 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
15 $ hg addremove -s50 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
16 adding another-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
17 removing empty-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
18 removing large-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
19 recording removal of large-file as rename to another-file (99% similar) |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
20 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
21 $ hg commit -m B |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
22 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
23 comparing two empty files caused ZeroDivisionError in the past |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
24 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
25 $ hg update -C 0 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
26 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
27 $ rm empty-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
28 $ touch another-empty-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
29 $ hg addremove -s50 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
30 adding another-empty-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
31 removing empty-file |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
32 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
33 $ cd .. |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
34 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
35 $ hg init rep2; cd rep2 |
4472
736e49292809
addremove: comparing two empty files caused ZeroDivisionError
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4135
diff
changeset
|
36 |
22947
c63a09b6b337
tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents:
16913
diff
changeset
|
37 $ $PYTHON -c 'for x in range(10000): print x' > large-file |
c63a09b6b337
tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents:
16913
diff
changeset
|
38 $ $PYTHON -c 'for x in range(50): print x' > tiny-file |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
39 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
40 $ hg addremove |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
41 adding large-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
42 adding tiny-file |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
43 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
44 $ hg commit -m A |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
45 |
22947
c63a09b6b337
tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents:
16913
diff
changeset
|
46 $ $PYTHON -c 'for x in range(70): print x' > small-file |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
47 $ rm tiny-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
48 $ rm large-file |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
49 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
50 $ hg addremove -s50 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
51 removing large-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
52 adding small-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
53 removing tiny-file |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
54 recording removal of tiny-file as rename to small-file (82% similar) |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
55 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
56 $ hg commit -m B |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
57 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
58 should all fail |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
59 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
60 $ hg addremove -s foo |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
61 abort: similarity must be a number |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11851
diff
changeset
|
62 [255] |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
63 $ hg addremove -s -1 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
64 abort: similarity must be between 0 and 100 |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11851
diff
changeset
|
65 [255] |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
66 $ hg addremove -s 1e6 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
67 abort: similarity must be between 0 and 100 |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11851
diff
changeset
|
68 [255] |
4135
6cb6cfe43c5d
Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff
changeset
|
69 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
70 $ cd .. |
4966
8d982aef0be1
addremove: print meaningful error message if --similar not numeric
Bryan O'Sullivan <bos@serpentine.com>
parents:
4472
diff
changeset
|
71 |
12399
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12346
diff
changeset
|
72 Issue1527: repeated addremove causes util.Abort |
8489
1a96f1d9599b
addremove/findrenames: find renames according to the match object (issue1527)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
4966
diff
changeset
|
73 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
74 $ hg init rep3; cd rep3 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
75 $ mkdir d |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
76 $ echo a > d/a |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
77 $ hg add d/a |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
78 $ hg commit -m 1 |
8489
1a96f1d9599b
addremove/findrenames: find renames according to the match object (issue1527)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
4966
diff
changeset
|
79 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
80 $ mv d/a d/b |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
81 $ hg addremove -s80 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
82 removing d/a |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
83 adding d/b |
15447
9910f60a37ee
tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
84 recording removal of d/a as rename to d/b (100% similar) (glob) |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
85 $ hg debugstate |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
86 r 0 0 1970-01-01 00:00:00 d/a |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
87 a 0 -1 unset d/b |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
88 copy: d/a -> d/b |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
89 $ mv d/b c |
8489
1a96f1d9599b
addremove/findrenames: find renames according to the match object (issue1527)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
4966
diff
changeset
|
90 |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
91 no copies found here (since the target isn't in d |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
92 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
93 $ hg addremove -s80 d |
23481
94091ab9d112
addremove: restore the relative path printing when files are named
Matt Harbison <matt_harbison@yahoo.com>
parents:
23465
diff
changeset
|
94 removing d/b (glob) |
11851
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
95 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
96 copies here |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
97 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
98 $ hg addremove -s80 |
db955418a6af
tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents:
8489
diff
changeset
|
99 adding c |
15447
9910f60a37ee
tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
100 recording removal of d/a as rename to c (100% similar) (glob) |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15447
diff
changeset
|
101 |
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15447
diff
changeset
|
102 $ cd .. |