tests/test-copies-unrelated.t
author Martin von Zweigbergk <martinvonz@google.com>
Mon, 01 Jul 2019 14:24:51 -0700
changeset 42589 67bf11597eb8
parent 42512 tests/test-copies.t@84aff7e20c55
child 42590 ab416b5d9b91
permissions -rw-r--r--
tests: split out tests for unrelated copy source/target into separate file I've realized only recently how many cases there are where a file is treated differently if it's considered "related" to another file (not deleted and re-added). I'll add more tests for some of these cases soon. Differential Revision: https://phab.mercurial-scm.org/D6598
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
     1
#testcases filelog compatibility changeset
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     3
  $ cat >> $HGRCPATH << EOF
41931
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
     4
  > [extensions]
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
     5
  > rebase=
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     6
  > [alias]
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     7
  > l = log -G -T '{rev} {desc}\n{files}\n'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     8
  > EOF
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     9
41756
49ad315b39ee copies: do copy tracing based on ctx.p[12]copies() if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 41755
diff changeset
    10
#if compatibility
49ad315b39ee copies: do copy tracing based on ctx.p[12]copies() if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 41755
diff changeset
    11
  $ cat >> $HGRCPATH << EOF
49ad315b39ee copies: do copy tracing based on ctx.p[12]copies() if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 41755
diff changeset
    12
  > [experimental]
49ad315b39ee copies: do copy tracing based on ctx.p[12]copies() if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 41755
diff changeset
    13
  > copies.read-from = compatibility
49ad315b39ee copies: do copy tracing based on ctx.p[12]copies() if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 41755
diff changeset
    14
  > EOF
49ad315b39ee copies: do copy tracing based on ctx.p[12]copies() if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 41755
diff changeset
    15
#endif
49ad315b39ee copies: do copy tracing based on ctx.p[12]copies() if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 41755
diff changeset
    16
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
    17
#if changeset
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
    18
  $ cat >> $HGRCPATH << EOF
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
    19
  > [experimental]
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
    20
  > copies.read-from = changeset-only
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
    21
  > copies.write-to = changeset-only
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
    22
  > EOF
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
    23
#endif
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
    24
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    25
  $ REPONUM=0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    26
  $ newrepo() {
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    27
  >     cd $TESTTMP
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    28
  >     REPONUM=`expr $REPONUM + 1`
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    29
  >     hg init repo-$REPONUM
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    30
  >     cd repo-$REPONUM
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    31
  > }
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    32
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    33
Copy a file, then delete destination, then copy again. This does not create a new filelog entry.
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    34
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    35
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    36
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    37
  $ hg cp x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    38
  $ hg ci -m 'copy x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    39
  $ hg rm y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    40
  $ hg ci -m 'remove y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    41
  $ hg cp -f x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    42
  $ hg ci -m 'copy x onto y (again)'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    43
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    44
  @  3 copy x onto y (again)
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    45
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    46
  o  2 remove y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    47
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    48
  o  1 copy x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    49
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    50
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    51
     x
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    52
  $ hg debugp1copies -r 3
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    53
  x -> y
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    54
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    55
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    56
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    57
Copy x to y, then remove y, then add back y. With copy metadata in the changeset, this could easily
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    58
end up reporting y as copied from x (if we don't unmark it as a copy when it's removed).
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    59
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    60
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    61
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    62
  $ hg mv x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    63
  $ hg ci -m 'rename x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    64
  $ hg rm y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    65
  $ hg ci -qm 'remove y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    66
  $ echo x > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    67
  $ hg ci -Aqm 'add back y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    68
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    69
  @  3 add back y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    70
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    71
  o  2 remove y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    72
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    73
  o  1 rename x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    74
  |  x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    75
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    76
     x
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    77
  $ hg debugp1copies -r 3
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    78
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    79
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    80
Copies via null revision (there shouldn't be any)
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    81
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    82
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    83
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    84
  $ hg cp x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    85
  $ hg ci -m 'copy x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    86
  $ hg co -q null
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    87
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    88
  $ hg ci -Aqm 'add x (again)'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    89
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    90
  @  2 add x (again)
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    91
     x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    92
  o  1 copy x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    93
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    94
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    95
     x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    96
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    97
  $ hg debugpathcopies 2 1