tests/test-copies.t
author Martin von Zweigbergk <martinvonz@google.com>
Wed, 27 Dec 2017 22:05:20 -0800
changeset 42142 5382d8f8530b
parent 41932 7694b685bb10
child 42222 57203e0210f8
child 42505 c1850798f995
permissions -rw-r--r--
changelog: parse copy metadata if available in extras This lets read back the copy metadata we just started writing. There are still many places left to teach about getting the copy information from the changeset, but we have enough ({file_copies}, specifically) that we can add it now and have some test coverage of it. Differential Revision: https://phab.mercurial-scm.org/D6186
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
Simple rename case
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 mv x y
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    38
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    39
  x -> y
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    40
  $ hg debugp2copies
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    41
  $ hg ci -m 'rename x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    42
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    43
  @  1 rename x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    44
  |  x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    45
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    46
     x
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    47
  $ hg debugp1copies -r 1
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    48
  x -> y
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    49
  $ hg debugpathcopies 0 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    50
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    51
  $ hg debugpathcopies 1 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    52
  y -> x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    53
Test filtering copies by path. We do filtering by destination.
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    54
  $ hg debugpathcopies 0 1 x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    55
  $ hg debugpathcopies 1 0 x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    56
  y -> x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    57
  $ hg debugpathcopies 0 1 y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    58
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    59
  $ hg debugpathcopies 1 0 y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    60
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    61
Copy a file onto another file
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    62
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    63
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    64
  $ echo y > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    65
  $ hg ci -Aqm 'add x and y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    66
  $ hg cp -f x y
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    67
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    68
  x -> y
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    69
  $ hg debugp2copies
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    70
  $ hg ci -m 'copy x onto y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    71
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    72
  @  1 copy x onto y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    73
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    74
  o  0 add x and y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    75
     x y
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    76
  $ hg debugp1copies -r 1
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    77
  x -> y
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    78
Incorrectly doesn't show the rename
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    79
  $ hg debugpathcopies 0 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    80
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    81
Copy a file onto another file with same content. If metadata is stored in changeset, this does not
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    82
produce a new filelog entry. The changeset's "files" entry should still list the file.
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    83
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    84
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    85
  $ echo x > x2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    86
  $ hg ci -Aqm 'add x and x2 with same content'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    87
  $ hg cp -f x x2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    88
  $ hg ci -m 'copy x onto x2'
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
  @  1 copy x onto x2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    91
  |  x2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    92
  o  0 add x and x2 with same content
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    93
     x x2
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    94
  $ hg debugp1copies -r 1
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
    95
  x -> x2
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    96
Incorrectly doesn't show the rename
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    97
  $ hg debugpathcopies 0 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    98
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    99
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
   100
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   101
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   102
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   103
  $ hg cp x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   104
  $ hg ci -m 'copy x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   105
  $ hg rm y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   106
  $ hg ci -m 'remove y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   107
  $ hg cp -f x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   108
  $ hg ci -m 'copy x onto y (again)'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   109
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   110
  @  3 copy x onto y (again)
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   111
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   112
  o  2 remove y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   113
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   114
  o  1 copy x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   115
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   116
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   117
     x
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   118
  $ 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
   119
  x -> y
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   120
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   121
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   122
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   123
Rename file in a loop: x->y->z->x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   124
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   125
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   126
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   127
  $ hg mv x y
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   128
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   129
  x -> y
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   130
  $ hg debugp2copies
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   131
  $ hg ci -m 'rename x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   132
  $ hg mv y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   133
  $ hg ci -m 'rename y to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   134
  $ hg mv z x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   135
  $ hg ci -m 'rename z to x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   136
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   137
  @  3 rename z to x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   138
  |  x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   139
  o  2 rename y to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   140
  |  y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   141
  o  1 rename x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   142
  |  x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   143
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   144
     x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   145
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   146
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   147
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
   148
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
   149
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   150
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   151
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   152
  $ hg mv x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   153
  $ hg ci -m 'rename x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   154
  $ hg rm y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   155
  $ hg ci -qm 'remove y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   156
  $ echo x > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   157
  $ hg ci -Aqm 'add back y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   158
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   159
  @  3 add back y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   160
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   161
  o  2 remove y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   162
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   163
  o  1 rename x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   164
  |  x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   165
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   166
     x
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   167
  $ hg debugp1copies -r 3
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   168
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   169
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   170
Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   171
changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   172
to the first commit that added the file. We should still report the copy as being from x2.
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   173
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   174
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   175
  $ echo x > x2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   176
  $ hg ci -Aqm 'add x and x2 with same content'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   177
  $ hg cp x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   178
  $ hg ci -qm 'copy x to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   179
  $ hg rm z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   180
  $ hg ci -m 'remove z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   181
  $ hg cp x2 z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   182
  $ hg ci -m 'copy x2 to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   183
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   184
  @  3 copy x2 to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   185
  |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   186
  o  2 remove z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   187
  |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   188
  o  1 copy x to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   189
  |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   190
  o  0 add x and x2 with same content
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   191
     x x2
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   192
  $ 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
   193
  x2 -> z
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   194
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   195
  x2 -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   196
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   197
Create x and y, then rename them both to the same name, but on different sides of a fork
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   198
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   199
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   200
  $ echo y > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   201
  $ hg ci -Aqm 'add x and y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   202
  $ hg mv x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   203
  $ hg ci -qm 'rename x to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   204
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   205
  $ hg mv y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   206
  $ hg ci -qm 'rename y to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   207
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   208
  @  2 rename y to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   209
  |  y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   210
  | o  1 rename x to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   211
  |/   x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   212
  o  0 add x and y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   213
     x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   214
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   215
  z -> x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   216
  y -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   217
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   218
Fork renames x to y on one side and removes x on the other
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   219
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   220
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   221
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   222
  $ hg mv x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   223
  $ hg ci -m 'rename x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   224
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   225
  $ hg rm x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   226
  $ hg ci -m 'remove x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   227
  created new head
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   228
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   229
  @  2 remove x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   230
  |  x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   231
  | o  1 rename x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   232
  |/   x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   233
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   234
     x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   235
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   236
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   237
Copies via null revision (there shouldn't be any)
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   238
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   239
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   240
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   241
  $ hg cp x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   242
  $ hg ci -m 'copy x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   243
  $ hg co -q null
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   244
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   245
  $ hg ci -Aqm 'add x (again)'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   246
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   247
  @  2 add x (again)
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   248
     x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   249
  o  1 copy x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   250
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   251
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   252
     x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   253
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   254
  $ hg debugpathcopies 2 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   255
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   256
Merge rename from other branch
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   257
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   258
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   259
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   260
  $ hg mv x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   261
  $ hg ci -m 'rename x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   262
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   263
  $ echo z > z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   264
  $ hg ci -Aqm 'add z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   265
  $ hg merge -q 1
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   266
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   267
  $ hg debugp2copies
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   268
  $ hg ci -m 'merge rename from p2'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   269
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   270
  @    3 merge rename from p2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   271
  |\   x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   272
  | o  2 add z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   273
  | |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   274
  o |  1 rename x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   275
  |/   x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   276
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   277
     x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   278
Perhaps we should indicate the rename here, but `hg status` is documented to be weird during
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   279
merges, so...
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   280
  $ 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
   281
  $ hg debugp2copies -r 3
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   282
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   283
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   284
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   285
  y -> x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   286
  $ hg debugpathcopies 1 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   287
  $ hg debugpathcopies 2 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   288
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   289
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   290
Copy file from either side in a merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   291
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   292
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   293
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   294
  $ hg co -q null
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   295
  $ echo y > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   296
  $ hg ci -Aqm 'add y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   297
  $ hg merge -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   298
  $ hg cp y z
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   299
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   300
  y -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   301
  $ hg debugp2copies
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   302
  $ hg ci -m 'copy file from p1 in merge'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   303
  $ hg co -q 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   304
  $ hg merge -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   305
  $ hg cp x z
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   306
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   307
  $ hg debugp2copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   308
  x -> z
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   309
  $ hg ci -qm 'copy file from p2 in merge'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   310
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   311
  @    3 copy file from p2 in merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   312
  |\   z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   313
  +---o  2 copy file from p1 in merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   314
  | |/   z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   315
  | o  1 add y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   316
  |    y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   317
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   318
     x
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   319
  $ hg debugp1copies -r 2
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   320
  y -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   321
  $ hg debugp2copies -r 2
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   322
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   323
  y -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   324
  $ hg debugpathcopies 0 2
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   325
  $ 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
   326
  $ hg debugp2copies -r 3
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   327
  x -> z
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   328
  $ hg debugpathcopies 1 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   329
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   330
  x -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   331
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   332
Copy file that exists on both sides of the merge, same content on both sides
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   333
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   334
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   335
  $ hg ci -Aqm 'add x on branch 1'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   336
  $ hg co -q null
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   337
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   338
  $ hg ci -Aqm 'add x on branch 2'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   339
  $ hg merge -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   340
  $ hg cp x z
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   341
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   342
  x -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   343
  $ hg debugp2copies
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   344
  $ hg ci -qm 'merge'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   345
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   346
  @    2 merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   347
  |\   z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   348
  | o  1 add x on branch 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   349
  |    x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   350
  o  0 add x on branch 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   351
     x
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   352
  $ hg debugp1copies -r 2
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   353
  x -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   354
  $ hg debugp2copies -r 2
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   355
It's a little weird that it shows up on both sides
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   356
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   357
  x -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   358
  $ hg debugpathcopies 0 2
41756
49ad315b39ee copies: do copy tracing based on ctx.p[12]copies() if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 41755
diff changeset
   359
  x -> z (filelog !)
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   360
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   361
Copy file that exists on both sides of the merge, different content
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   362
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   363
  $ echo branch1 > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   364
  $ hg ci -Aqm 'add x on branch 1'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   365
  $ hg co -q null
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   366
  $ echo branch2 > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   367
  $ hg ci -Aqm 'add x on branch 2'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   368
  $ hg merge -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   369
  warning: conflicts while merging x! (edit, then use 'hg resolve --mark')
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   370
  [1]
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   371
  $ echo resolved > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   372
  $ hg resolve -m x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   373
  (no more unresolved files)
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   374
  $ hg cp x z
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   375
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   376
  x -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   377
  $ hg debugp2copies
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   378
  $ hg ci -qm 'merge'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   379
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   380
  @    2 merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   381
  |\   x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   382
  | o  1 add x on branch 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   383
  |    x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   384
  o  0 add x on branch 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   385
     x
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   386
  $ hg debugp1copies -r 2
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
   387
  x -> z (changeset !)
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   388
  $ hg debugp2copies -r 2
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
   389
  x -> z (no-changeset !)
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   390
  $ hg debugpathcopies 1 2
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
   391
  x -> z (changeset !)
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   392
  $ hg debugpathcopies 0 2
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
   393
  x -> z (no-changeset !)
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   394
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   395
Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   396
of the merge to the merge should include the copy from the other side.
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   397
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   398
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   399
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   400
  $ hg cp x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   401
  $ hg ci -qm 'copy x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   402
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   403
  $ hg cp x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   404
  $ hg ci -qm 'copy x to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   405
  $ hg merge -q 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   406
  $ hg ci -m 'merge copy x->y and copy x->z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   407
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   408
  @    3 merge copy x->y and copy x->z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   409
  |\
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   410
  | o  2 copy x to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   411
  | |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   412
  o |  1 copy x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   413
  |/   y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   414
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   415
     x
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   416
  $ 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
   417
  $ hg debugp2copies -r 3
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   418
  $ hg debugpathcopies 2 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   419
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   420
  $ hg debugpathcopies 1 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   421
  x -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   422
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   423
Copy x to y on one side of merge, create y and rename to z on the other side. Pathcopies from the
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   424
first side should not include the y->z rename since y didn't exist in the merge base.
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   425
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   426
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   427
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   428
  $ hg cp x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   429
  $ hg ci -qm 'copy x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   430
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   431
  $ echo y > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   432
  $ hg ci -Aqm 'add y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   433
  $ hg mv y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   434
  $ hg ci -m 'rename y to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   435
  $ hg merge -q 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   436
  $ hg ci -m 'merge'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   437
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   438
  @    4 merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   439
  |\
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   440
  | o  3 rename y to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   441
  | |  y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   442
  | o  2 add y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   443
  | |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   444
  o |  1 copy x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   445
  |/   y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   446
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   447
     x
41755
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   448
  $ 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
   449
  y -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41754
diff changeset
   450
  $ hg debugp2copies -r 3
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   451
  $ hg debugpathcopies 2 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   452
  y -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   453
  $ hg debugpathcopies 1 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   454
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   455
Create x and y, then rename x to z on one side of merge, and rename y to z and modify z on the
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   456
other side.
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   457
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   458
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   459
  $ echo y > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   460
  $ hg ci -Aqm 'add x and y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   461
  $ hg mv x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   462
  $ hg ci -qm 'rename x to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   463
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   464
  $ hg mv y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   465
  $ hg ci -qm 'rename y to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   466
  $ echo z >> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   467
  $ hg ci -m 'modify z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   468
  $ hg merge -q 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   469
  warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   470
  [1]
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   471
  $ echo z > z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   472
  $ hg resolve -qm z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   473
  $ hg ci -m 'merge 1 into 3'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   474
Try merging the other direction too
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   475
  $ hg co -q 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   476
  $ hg merge -q 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   477
  warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   478
  [1]
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   479
  $ echo z > z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   480
  $ hg resolve -qm z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   481
  $ hg ci -m 'merge 3 into 1'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   482
  created new head
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   483
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   484
  @    5 merge 3 into 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   485
  |\   y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   486
  +---o  4 merge 1 into 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   487
  | |/   x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   488
  | o  3 modify z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   489
  | |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   490
  | o  2 rename y to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   491
  | |  y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   492
  o |  1 rename x to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   493
  |/   x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   494
  o  0 add x and y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   495
     x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   496
  $ hg debugpathcopies 1 4
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   497
  $ hg debugpathcopies 2 4
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   498
  $ hg debugpathcopies 0 4
41756
49ad315b39ee copies: do copy tracing based on ctx.p[12]copies() if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 41755
diff changeset
   499
  x -> z (filelog !)
49ad315b39ee copies: do copy tracing based on ctx.p[12]copies() if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 41755
diff changeset
   500
  y -> z (compatibility !)
41751
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   501
  $ hg debugpathcopies 1 5
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   502
  $ hg debugpathcopies 2 5
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   503
  $ hg debugpathcopies 0 5
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   504
  x -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   505
41930
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   506
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   507
Test for a case in fullcopytracing algorithm where both the merging csets are
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   508
"dirty"; where a dirty cset means that cset is descendant of merge base. This
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   509
test reflect that for this particular case this algorithm correctly find the copies:
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   510
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   511
  $ cat >> $HGRCPATH << EOF
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   512
  > [experimental]
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   513
  > evolution.createmarkers=True
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   514
  > evolution.allowunstable=True
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   515
  > EOF
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   516
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   517
  $ newrepo
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   518
  $ echo a > a
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   519
  $ hg add a
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   520
  $ hg ci -m "added a"
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   521
  $ echo b > b
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   522
  $ hg add b
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   523
  $ hg ci -m "added b"
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   524
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   525
  $ hg mv b b1
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   526
  $ hg ci -m "rename b to b1"
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   527
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   528
  $ hg up ".^"
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   529
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   530
  $ echo d > d
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   531
  $ hg add d
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   532
  $ hg ci -m "added d"
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   533
  created new head
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   534
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   535
  $ echo baba >> b
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   536
  $ hg ci --amend -m "added d, modified b"
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   537
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   538
  $ hg l --hidden
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   539
  @  4 added d, modified b
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   540
  |  b d
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   541
  | x  3 added d
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   542
  |/   d
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   543
  | o  2 rename b to b1
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   544
  |/   b b1
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   545
  o  1 added b
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   546
  |  b
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   547
  o  0 added a
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   548
     a
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   549
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   550
Grafting revision 4 on top of revision 2, showing that it respect the rename:
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   551
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
   552
TODO: Make this work with copy info in changesets (probably by writing a
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
   553
changeset-centric version of copies.mergecopies())
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
   554
#if no-changeset
41930
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   555
  $ hg up 2 -q
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   556
  $ hg graft -r 4 --base 3 --hidden
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   557
  grafting 4:af28412ec03c "added d, modified b" (tip)
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   558
  merging b1 and b to b1
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   559
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   560
  $ hg l -l1 -p
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   561
  @  5 added d, modified b
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   562
  |  b1
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   563
  ~  diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   564
     --- a/b1	Thu Jan 01 00:00:00 1970 +0000
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   565
     +++ b/b1	Thu Jan 01 00:00:00 1970 +0000
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   566
     @@ -1,1 +1,2 @@
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   567
      b
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   568
     +baba
cbdd2b56d4c3 copies: add test that makes both the merging csets dirty and run w/o error
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41756
diff changeset
   569
  
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
   570
#endif
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 41932
diff changeset
   571
41932
7694b685bb10 copies: handle a case when both merging csets are not descendant of merge base
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41931
diff changeset
   572
Test to make sure that fullcopytracing algorithm don't fail when both the merging csets are dirty
7694b685bb10 copies: handle a case when both merging csets are not descendant of merge base
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41931
diff changeset
   573
(a dirty cset is one who is not the descendant of merge base)
7694b685bb10 copies: handle a case when both merging csets are not descendant of merge base
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41931
diff changeset
   574
-------------------------------------------------------------------------------------------------
41931
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   575
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   576
  $ newrepo
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   577
  $ echo a > a
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   578
  $ hg add a
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   579
  $ hg ci -m "added a"
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   580
  $ echo b > b
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   581
  $ hg add b
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   582
  $ hg ci -m "added b"
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   583
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   584
  $ echo foobar > willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   585
  $ hg add willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   586
  $ hg ci -m "added willconflict"
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   587
  $ echo c > c
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   588
  $ hg add c
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   589
  $ hg ci -m "added c"
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   590
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   591
  $ hg l
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   592
  @  3 added c
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   593
  |  c
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   594
  o  2 added willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   595
  |  willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   596
  o  1 added b
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   597
  |  b
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   598
  o  0 added a
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   599
     a
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   600
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   601
  $ hg up ".^^"
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   602
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   603
  $ echo d > d
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   604
  $ hg add d
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   605
  $ hg ci -m "added d"
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   606
  created new head
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   607
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   608
  $ echo barfoo > willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   609
  $ hg add willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   610
  $ hg ci --amend -m "added willconflict and d"
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   611
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   612
  $ hg l
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   613
  @  5 added willconflict and d
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   614
  |  d willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   615
  | o  3 added c
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   616
  | |  c
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   617
  | o  2 added willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   618
  |/   willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   619
  o  1 added b
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   620
  |  b
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   621
  o  0 added a
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   622
     a
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   623
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   624
  $ hg rebase -r . -d 2 -t :other
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   625
  rebasing 5:5018b1509e94 "added willconflict and d" (tip)
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   626
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   627
  $ hg up 3 -q
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   628
  $ hg l --hidden
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   629
  o  6 added willconflict and d
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   630
  |  d willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   631
  | x  5 added willconflict and d
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   632
  | |  d willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   633
  | | x  4 added d
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   634
  | |/   d
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   635
  +---@  3 added c
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   636
  | |    c
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   637
  o |  2 added willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   638
  |/   willconflict
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   639
  o  1 added b
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   640
  |  b
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   641
  o  0 added a
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   642
     a
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   643
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   644
Now if we trigger a merge between cset revision 3 and 6 using base revision 4, in this case
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   645
both the merging csets will be dirty as no one is descendent of base revision:
fc4b7a46fda1 copies: add test that makes both the merging csets dirty and fails
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41930
diff changeset
   646
41932
7694b685bb10 copies: handle a case when both merging csets are not descendant of merge base
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41931
diff changeset
   647
  $ hg graft -r 6 --base 4 --hidden -t :other
7694b685bb10 copies: handle a case when both merging csets are not descendant of merge base
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41931
diff changeset
   648
  grafting 6:99802e4f1e46 "added willconflict and d" (tip)