tests/test-copies-unrelated.t
changeset 42589 67bf11597eb8
parent 42512 84aff7e20c55
child 42590 ab416b5d9b91
equal deleted inserted replaced
42588:f6540aba8e3e 42589:67bf11597eb8
       
     1 #testcases filelog compatibility changeset
       
     2 
       
     3   $ cat >> $HGRCPATH << EOF
       
     4   > [extensions]
       
     5   > rebase=
       
     6   > [alias]
       
     7   > l = log -G -T '{rev} {desc}\n{files}\n'
       
     8   > EOF
       
     9 
       
    10 #if compatibility
       
    11   $ cat >> $HGRCPATH << EOF
       
    12   > [experimental]
       
    13   > copies.read-from = compatibility
       
    14   > EOF
       
    15 #endif
       
    16 
       
    17 #if changeset
       
    18   $ cat >> $HGRCPATH << EOF
       
    19   > [experimental]
       
    20   > copies.read-from = changeset-only
       
    21   > copies.write-to = changeset-only
       
    22   > EOF
       
    23 #endif
       
    24 
       
    25   $ REPONUM=0
       
    26   $ newrepo() {
       
    27   >     cd $TESTTMP
       
    28   >     REPONUM=`expr $REPONUM + 1`
       
    29   >     hg init repo-$REPONUM
       
    30   >     cd repo-$REPONUM
       
    31   > }
       
    32 
       
    33 Copy a file, then delete destination, then copy again. This does not create a new filelog entry.
       
    34   $ newrepo
       
    35   $ echo x > x
       
    36   $ hg ci -Aqm 'add x'
       
    37   $ hg cp x y
       
    38   $ hg ci -m 'copy x to y'
       
    39   $ hg rm y
       
    40   $ hg ci -m 'remove y'
       
    41   $ hg cp -f x y
       
    42   $ hg ci -m 'copy x onto y (again)'
       
    43   $ hg l
       
    44   @  3 copy x onto y (again)
       
    45   |  y
       
    46   o  2 remove y
       
    47   |  y
       
    48   o  1 copy x to y
       
    49   |  y
       
    50   o  0 add x
       
    51      x
       
    52   $ hg debugp1copies -r 3
       
    53   x -> y
       
    54   $ hg debugpathcopies 0 3
       
    55   x -> y
       
    56 
       
    57 Copy x to y, then remove y, then add back y. With copy metadata in the changeset, this could easily
       
    58 end up reporting y as copied from x (if we don't unmark it as a copy when it's removed).
       
    59   $ newrepo
       
    60   $ echo x > x
       
    61   $ hg ci -Aqm 'add x'
       
    62   $ hg mv x y
       
    63   $ hg ci -m 'rename x to y'
       
    64   $ hg rm y
       
    65   $ hg ci -qm 'remove y'
       
    66   $ echo x > y
       
    67   $ hg ci -Aqm 'add back y'
       
    68   $ hg l
       
    69   @  3 add back y
       
    70   |  y
       
    71   o  2 remove y
       
    72   |  y
       
    73   o  1 rename x to y
       
    74   |  x y
       
    75   o  0 add x
       
    76      x
       
    77   $ hg debugp1copies -r 3
       
    78   $ hg debugpathcopies 0 3
       
    79 
       
    80 Copies via null revision (there shouldn't be any)
       
    81   $ newrepo
       
    82   $ echo x > x
       
    83   $ hg ci -Aqm 'add x'
       
    84   $ hg cp x y
       
    85   $ hg ci -m 'copy x to y'
       
    86   $ hg co -q null
       
    87   $ echo x > x
       
    88   $ hg ci -Aqm 'add x (again)'
       
    89   $ hg l
       
    90   @  2 add x (again)
       
    91      x
       
    92   o  1 copy x to y
       
    93   |  y
       
    94   o  0 add x
       
    95      x
       
    96   $ hg debugpathcopies 1 2
       
    97   $ hg debugpathcopies 2 1