tests/test-addremove-similar.t
author Gregory Szorc <gregory.szorc@gmail.com>
Thu, 06 Sep 2018 14:04:46 -0700
changeset 39568 842cd0bdda75
parent 35393 4441705b7111
child 39707 5abc47d4ca6b
permissions -rw-r--r--
util: teach lrucachedict to enforce a max total cost Now that lrucachedict entries can have a numeric cost associated with them and we can easily pop the oldest item in the cache, it now becomes relatively trivial to implement support for enforcing a high water mark on the total cost of items in the cache. This commit teaches lrucachedict instances to have a max cost associated with them. When items are inserted, we pop old items until enough "cost" frees up to make room for the new item. This feature is close to zero cost when not used (modulo the insertion regressed introduced by the previous commit): $ ./hg perflrucachedict --size 4 --gets 1000000 --sets 1000000 --mixed 1000000 ! gets ! wall 0.607444 comb 0.610000 user 0.610000 sys 0.000000 (best of 17) ! wall 0.601653 comb 0.600000 user 0.600000 sys 0.000000 (best of 17) ! inserts ! wall 0.678261 comb 0.680000 user 0.680000 sys 0.000000 (best of 14) ! wall 0.685042 comb 0.680000 user 0.680000 sys 0.000000 (best of 15) ! sets ! wall 0.808770 comb 0.800000 user 0.800000 sys 0.000000 (best of 13) ! wall 0.834241 comb 0.830000 user 0.830000 sys 0.000000 (best of 12) ! mixed ! wall 0.782441 comb 0.780000 user 0.780000 sys 0.000000 (best of 13) ! wall 0.803804 comb 0.800000 user 0.800000 sys 0.000000 (best of 13) $ hg perflrucachedict --size 1000 --gets 1000000 --sets 1000000 --mixed 1000000 ! init ! wall 0.006952 comb 0.010000 user 0.010000 sys 0.000000 (best of 418) ! gets ! wall 0.613350 comb 0.610000 user 0.610000 sys 0.000000 (best of 17) ! wall 0.617415 comb 0.620000 user 0.620000 sys 0.000000 (best of 17) ! inserts ! wall 0.701270 comb 0.700000 user 0.700000 sys 0.000000 (best of 15) ! wall 0.700516 comb 0.700000 user 0.700000 sys 0.000000 (best of 15) ! sets ! wall 0.825720 comb 0.830000 user 0.830000 sys 0.000000 (best of 13) ! wall 0.837946 comb 0.840000 user 0.830000 sys 0.010000 (best of 12) ! mixed ! wall 0.821644 comb 0.820000 user 0.820000 sys 0.000000 (best of 13) ! wall 0.850559 comb 0.850000 user 0.850000 sys 0.000000 (best of 12) I reckon the slight slowdown on insert is due to added if checks. For caches with total cost limiting enabled: $ hg perflrucachedict --size 4 --gets 1000000 --sets 1000000 --mixed 1000000 --costlimit 100 ! gets w/ cost limit ! wall 0.598737 comb 0.590000 user 0.590000 sys 0.000000 (best of 17) ! inserts w/ cost limit ! wall 1.694282 comb 1.700000 user 1.700000 sys 0.000000 (best of 6) ! mixed w/ cost limit ! wall 1.157655 comb 1.150000 user 1.150000 sys 0.000000 (best of 9) $ hg perflrucachedict --size 1000 --gets 1000000 --sets 1000000 --mixed 1000000 --costlimit 10000 ! gets w/ cost limit ! wall 0.598526 comb 0.600000 user 0.600000 sys 0.000000 (best of 17) ! inserts w/ cost limit ! wall 37.838315 comb 37.840000 user 37.840000 sys 0.000000 (best of 3) ! mixed w/ cost limit ! wall 18.060198 comb 18.060000 user 18.060000 sys 0.000000 (best of 3) $ hg perflrucachedict --size 1000 --gets 1000000 --sets 1000000 --mixed 1000000 --costlimit 10000 --mixedgetfreq 90 ! gets w/ cost limit ! wall 0.600024 comb 0.600000 user 0.600000 sys 0.000000 (best of 17) ! inserts w/ cost limit ! wall 37.154547 comb 37.120000 user 37.120000 sys 0.000000 (best of 3) ! mixed w/ cost limit ! wall 4.381602 comb 4.380000 user 4.370000 sys 0.010000 (best of 3) The functions we're benchmarking are slightly different, which could move numbers by a few milliseconds. But the slowdown on insert is too great to be explained by that. The slowness is due to insert heavy operations needing to call popoldest() repeatedly when the cache is at capacity. The next commit will address this. Differential Revision: https://phab.mercurial-scm.org/D4503
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
29174
478e2b85fcce tests: test-addremove-similar.t use print() for py3
timeless <timeless@mozdev.org>
parents: 26587
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
29174
478e2b85fcce tests: test-addremove-similar.t use print() for py3
timeless <timeless@mozdev.org>
parents: 26587
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
29174
478e2b85fcce tests: test-addremove-similar.t use print() for py3
timeless <timeless@mozdev.org>
parents: 26587
diff changeset
    37
  $ $PYTHON -c 'for x in range(10000): print(x)' > large-file
478e2b85fcce tests: test-addremove-similar.t use print() for py3
timeless <timeless@mozdev.org>
parents: 26587
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
29174
478e2b85fcce tests: test-addremove-similar.t use print() for py3
timeless <timeless@mozdev.org>
parents: 26587
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
31579
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    58
should be sorted by path for stable result
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    59
32940
75be14993fda cleanup: use $PYTHON to run python in many more tests
Augie Fackler <augie@google.com>
parents: 31583
diff changeset
    60
  $ for i in `$PYTHON $TESTDIR/seq.py 0 9`; do
31579
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    61
  >     cp small-file $i
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    62
  > done
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    63
  $ rm small-file
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    64
  $ hg addremove
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    65
  adding 0
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    66
  adding 1
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    67
  adding 2
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    68
  adding 3
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    69
  adding 4
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    70
  adding 5
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    71
  adding 6
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    72
  adding 7
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    73
  adding 8
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    74
  adding 9
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    75
  removing small-file
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    76
  recording removal of small-file as rename to 0 (100% similar)
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    77
  recording removal of small-file as rename to 1 (100% similar)
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    78
  recording removal of small-file as rename to 2 (100% similar)
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    79
  recording removal of small-file as rename to 3 (100% similar)
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    80
  recording removal of small-file as rename to 4 (100% similar)
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    81
  recording removal of small-file as rename to 5 (100% similar)
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    82
  recording removal of small-file as rename to 6 (100% similar)
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    83
  recording removal of small-file as rename to 7 (100% similar)
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    84
  recording removal of small-file as rename to 8 (100% similar)
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    85
  recording removal of small-file as rename to 9 (100% similar)
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    86
  $ hg commit -m '10 same files'
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    87
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    88
pick one from many identical files
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    89
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    90
  $ cp 0 a
32940
75be14993fda cleanup: use $PYTHON to run python in many more tests
Augie Fackler <augie@google.com>
parents: 31583
diff changeset
    91
  $ rm `$PYTHON $TESTDIR/seq.py 0 9`
31579
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    92
  $ hg addremove
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    93
  removing 0
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    94
  removing 1
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    95
  removing 2
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    96
  removing 3
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    97
  removing 4
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    98
  removing 5
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
    99
  removing 6
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   100
  removing 7
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   101
  removing 8
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   102
  removing 9
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   103
  adding a
31583
2efd9771323e similar: take the first match instead of the last
Yuya Nishihara <yuya@tcha.org>
parents: 31579
diff changeset
   104
  recording removal of 0 as rename to a (100% similar)
31579
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   105
  $ hg revert -aq
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   106
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   107
pick one from many similar files
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   108
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   109
  $ cp 0 a
32940
75be14993fda cleanup: use $PYTHON to run python in many more tests
Augie Fackler <augie@google.com>
parents: 31583
diff changeset
   110
  $ for i in `$PYTHON $TESTDIR/seq.py 0 9`; do
31579
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   111
  >     echo $i >> $i
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   112
  > done
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   113
  $ hg commit -m 'make them slightly different'
32940
75be14993fda cleanup: use $PYTHON to run python in many more tests
Augie Fackler <augie@google.com>
parents: 31583
diff changeset
   114
  $ rm `$PYTHON $TESTDIR/seq.py 0 9`
31579
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   115
  $ hg addremove -s50
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   116
  removing 0
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   117
  removing 1
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   118
  removing 2
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   119
  removing 3
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   120
  removing 4
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   121
  removing 5
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   122
  removing 6
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   123
  removing 7
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   124
  removing 8
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   125
  removing 9
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   126
  adding a
31583
2efd9771323e similar: take the first match instead of the last
Yuya Nishihara <yuya@tcha.org>
parents: 31579
diff changeset
   127
  recording removal of 0 as rename to a (99% similar)
31579
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   128
  $ hg commit -m 'always the same file should be selected'
3a383caa97f4 similar: sort files not by object id but by path for stable result
Yuya Nishihara <yuya@tcha.org>
parents: 29174
diff changeset
   129
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   130
should all fail
4135
6cb6cfe43c5d Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff changeset
   131
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   132
  $ hg addremove -s foo
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   133
  abort: similarity must be a number
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11851
diff changeset
   134
  [255]
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   135
  $ hg addremove -s -1
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   136
  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
   137
  [255]
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   138
  $ hg addremove -s 1e6
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   139
  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
   140
  [255]
4135
6cb6cfe43c5d Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff changeset
   141
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   142
  $ cd ..
4966
8d982aef0be1 addremove: print meaningful error message if --similar not numeric
Bryan O'Sullivan <bos@serpentine.com>
parents: 4472
diff changeset
   143
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23481
diff changeset
   144
Issue1527: repeated addremove causes Abort
8489
1a96f1d9599b addremove/findrenames: find renames according to the match object (issue1527)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 4966
diff changeset
   145
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   146
  $ hg init rep3; cd rep3
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   147
  $ mkdir d
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   148
  $ echo a > d/a
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   149
  $ hg add d/a
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   150
  $ 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
   151
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   152
  $ mv d/a d/b
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   153
  $ hg addremove -s80
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   154
  removing d/a
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   155
  adding d/b
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 32940
diff changeset
   156
  recording removal of d/a as rename to d/b (100% similar)
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   157
  $ hg debugstate
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   158
  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
   159
  a   0         -1 unset               d/b
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   160
  copy: d/a -> d/b
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   161
  $ 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
   162
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   163
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
   164
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   165
  $ hg addremove -s80 d
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 32940
diff changeset
   166
  removing d/b
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   167
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   168
copies here
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   169
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   170
  $ hg addremove -s80
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
   171
  adding c
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 32940
diff changeset
   172
  recording removal of d/a as rename to c (100% similar)
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 15447
diff changeset
   173
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 15447
diff changeset
   174
  $ cd ..