tests/test-addremove-similar.t
changeset 11851 db955418a6af
parent 8489 1a96f1d9599b
child 12316 4134686b83e1
equal deleted inserted replaced
11850:54dbf16b401f 11851:db955418a6af
       
     1   $ hg init rep; cd rep
       
     2 
       
     3   $ touch empty-file
       
     4   $ python -c 'for x in range(10000): print x' > large-file
       
     5 
       
     6   $ hg addremove
       
     7   adding empty-file
       
     8   adding large-file
       
     9 
       
    10   $ hg commit -m A
       
    11 
       
    12   $ rm large-file empty-file
       
    13   $ python -c 'for x in range(10,10000): print x' > another-file
       
    14 
       
    15   $ hg addremove -s50
       
    16   adding another-file
       
    17   removing empty-file
       
    18   removing large-file
       
    19   recording removal of large-file as rename to another-file (99% similar)
       
    20 
       
    21   $ hg commit -m B
       
    22 
       
    23 comparing two empty files caused ZeroDivisionError in the past
       
    24 
       
    25   $ hg update -C 0
       
    26   2 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    27   $ rm empty-file
       
    28   $ touch another-empty-file
       
    29   $ hg addremove -s50
       
    30   adding another-empty-file
       
    31   removing empty-file
       
    32 
       
    33   $ cd ..
       
    34 
       
    35   $ hg init rep2; cd rep2
       
    36 
       
    37   $ python -c 'for x in range(10000): print x' > large-file
       
    38   $ python -c 'for x in range(50): print x' > tiny-file
       
    39 
       
    40   $ hg addremove
       
    41   adding large-file
       
    42   adding tiny-file
       
    43 
       
    44   $ hg commit -m A
       
    45 
       
    46   $ python -c 'for x in range(70): print x' > small-file
       
    47   $ rm tiny-file
       
    48   $ rm large-file
       
    49 
       
    50   $ hg addremove -s50
       
    51   removing large-file
       
    52   adding small-file
       
    53   removing tiny-file
       
    54   recording removal of tiny-file as rename to small-file (82% similar)
       
    55 
       
    56   $ hg commit -m B
       
    57 
       
    58 should all fail
       
    59 
       
    60   $ hg addremove -s foo
       
    61   abort: similarity must be a number
       
    62   $ hg addremove -s -1
       
    63   abort: similarity must be between 0 and 100
       
    64   $ hg addremove -s 1e6
       
    65   abort: similarity must be between 0 and 100
       
    66 
       
    67   $ cd ..
       
    68 
       
    69 issue 1527
       
    70 
       
    71   $ hg init rep3; cd rep3
       
    72   $ mkdir d
       
    73   $ echo a > d/a
       
    74   $ hg add d/a
       
    75   $ hg commit -m 1
       
    76 
       
    77   $ mv d/a d/b
       
    78   $ hg addremove -s80
       
    79   removing d/a
       
    80   adding d/b
       
    81   recording removal of d/a as rename to d/b (100% similar)
       
    82   $ hg debugstate
       
    83   r   0          0 1970-01-01 00:00:00 d/a
       
    84   a   0         -1 unset               d/b
       
    85   copy: d/a -> d/b
       
    86   $ mv d/b c
       
    87 
       
    88 no copies found here (since the target isn't in d
       
    89 
       
    90   $ hg addremove -s80 d
       
    91   removing d/b
       
    92 
       
    93 copies here
       
    94 
       
    95   $ hg addremove -s80
       
    96   adding c
       
    97   recording removal of d/a as rename to c (100% similar)
       
    98 
       
    99   $ true