tests/test-addremove-similar.t
author Bryan O'Sullivan <bryano@fb.com>
Mon, 03 Jun 2013 17:20:45 -0700
changeset 19287 8b04e1344111
parent 16913 f2719b387380
child 22947 c63a09b6b337
permissions -rw-r--r--
util: add an optional timestamp parameter to makedate This will be used by the upcoming shelve extension.
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
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
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 12399
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 ..