tests/test-addremove-similar.t
author Martin Geisler <mg@lazybytes.net>
Fri, 03 Sep 2010 12:58:51 +0200
changeset 12165 b7fbf24c8a93
parent 11851 db955418a6af
child 12316 4134686b83e1
permissions -rw-r--r--
match: add narrowmatcher class This class can be used to adapt an existing match object to a new match object that only cares about paths within a certain subdirectory.
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
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
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
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
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
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    37
  $ python -c 'for x in range(10000): print x' > large-file
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
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
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    46
  $ python -c 'for x in range(70): print x' > small-file
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
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    62
  $ hg addremove -s -1
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    63
  abort: similarity must be between 0 and 100
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    64
  $ hg addremove -s 1e6
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    65
  abort: similarity must be between 0 and 100
4135
6cb6cfe43c5d Avoid some false positives for addremove -s
Erling Ellingsen <erlingalf@gmail.com>
parents:
diff changeset
    66
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    67
  $ cd ..
4966
8d982aef0be1 addremove: print meaningful error message if --similar not numeric
Bryan O'Sullivan <bos@serpentine.com>
parents: 4472
diff changeset
    68
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    69
issue 1527
8489
1a96f1d9599b addremove/findrenames: find renames according to the match object (issue1527)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 4966
diff changeset
    70
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    71
  $ hg init rep3; cd rep3
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    72
  $ mkdir d
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    73
  $ echo a > d/a
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    74
  $ hg add d/a
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    75
  $ 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
    76
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    77
  $ mv d/a d/b
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    78
  $ hg addremove -s80
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    79
  removing d/a
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    80
  adding d/b
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    81
  recording removal of d/a as rename to d/b (100% similar)
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    82
  $ hg debugstate
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    83
  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
    84
  a   0         -1 unset               d/b
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    85
  copy: d/a -> d/b
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    86
  $ 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
    87
11851
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    88
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
    89
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    90
  $ hg addremove -s80 d
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    91
  removing d/b
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
copies here
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    94
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    95
  $ hg addremove -s80
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    96
  adding c
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    97
  recording removal of d/a as rename to c (100% similar)
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    98
db955418a6af tests: unify test-addremove-similar
Martin Geisler <mg@lazybytes.net>
parents: 8489
diff changeset
    99
  $ true