tests/test-copies.t
author Martin von Zweigbergk <martinvonz@google.com>
Fri, 18 Jan 2019 13:13:30 -0800
changeset 41764 a4358f7345b4
parent 41763 d5edb5d3a337
child 41765 49ad315b39ee
permissions -rw-r--r--
context: introduce p[12]copies() methods and debugp[12]copies commands As mentioned earlier, I'm working on support for storing copy metadata in the changeset instead of in the filelog. In order to transition a repo from storing metadata in filelogs to storing it in the changeset, I'm going to provide a config option for reading the metadata from the changeset, but falling back to getting it from the filelog if it's not in the changeset. In this compatiblity mode, the changeset-optmized algorithms will be used. We will then need to convert the filelog copy metadata to look like that provided by changeset copy metadata. This patch introduces methods that do just that. By having these methods here, we can start writing changeset-optimized algorithms that should work already before we add any support for storing the metadata in the changesets. This commit also includes new debugp[12]copies commands and exercises them in test-copies.t. Differential Revision: https://phab.mercurial-scm.org/D5990
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     2
  $ cat >> $HGRCPATH << EOF
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     3
  > [alias]
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     4
  > l = log -G -T '{rev} {desc}\n{files}\n'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     5
  > EOF
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     6
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     7
  $ REPONUM=0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     8
  $ newrepo() {
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     9
  >     cd $TESTTMP
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    10
  >     REPONUM=`expr $REPONUM + 1`
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    11
  >     hg init repo-$REPONUM
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    12
  >     cd repo-$REPONUM
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    13
  > }
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    14
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    15
Simple rename case
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    16
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    17
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    18
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    19
  $ hg mv x y
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
    20
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
    21
  x -> y
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
    22
  $ hg debugp2copies
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    23
  $ hg ci -m 'rename x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    24
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    25
  @  1 rename x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    26
  |  x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    27
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    28
     x
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
    29
  $ hg debugp1copies -r 1
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
    30
  x -> y
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    31
  $ hg debugpathcopies 0 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    32
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    33
  $ hg debugpathcopies 1 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    34
  y -> x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    35
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
    36
  $ hg debugpathcopies 0 1 x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    37
  $ hg debugpathcopies 1 0 x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    38
  y -> x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    39
  $ hg debugpathcopies 0 1 y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    40
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    41
  $ hg debugpathcopies 1 0 y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    42
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    43
Copy a file onto another file
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    44
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    45
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    46
  $ echo y > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    47
  $ hg ci -Aqm 'add x and y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    48
  $ hg cp -f x y
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
    49
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
    50
  x -> y
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
    51
  $ hg debugp2copies
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    52
  $ hg ci -m 'copy x onto y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    53
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    54
  @  1 copy x onto y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    55
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    56
  o  0 add x and y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    57
     x y
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
    58
  $ hg debugp1copies -r 1
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
    59
  x -> y
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    60
Incorrectly doesn't show the rename
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    61
  $ hg debugpathcopies 0 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    62
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    63
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
    64
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
    65
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    66
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    67
  $ echo x > x2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    68
  $ 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
    69
  $ hg cp -f x x2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    70
  $ hg ci -m 'copy x onto x2'
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 x2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    73
  |  x2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    74
  o  0 add x and x2 with same content
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    75
     x x2
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
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: 41763
diff changeset
    77
  x -> x2
41760
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, 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
    82
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    83
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    84
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    85
  $ hg cp x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    86
  $ hg ci -m 'copy x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    87
  $ hg rm y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    88
  $ hg ci -m 'remove y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    89
  $ hg cp -f x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    90
  $ hg ci -m 'copy x onto y (again)'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    91
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    92
  @  3 copy x onto y (again)
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    93
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    94
  o  2 remove y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    95
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    96
  o  1 copy x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    97
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    98
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    99
     x
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   100
  $ hg debugp1copies -r 3
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   101
  x -> y
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   102
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   103
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   104
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   105
Rename file in a loop: x->y->z->x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   106
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   107
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   108
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   109
  $ hg mv x y
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   110
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   111
  x -> y
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   112
  $ hg debugp2copies
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   113
  $ hg ci -m 'rename x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   114
  $ hg mv y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   115
  $ hg ci -m 'rename y to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   116
  $ hg mv z x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   117
  $ hg ci -m 'rename z to x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   118
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   119
  @  3 rename z to x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   120
  |  x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   121
  o  2 rename y to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   122
  |  y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   123
  o  1 rename x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   124
  |  x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   125
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   126
     x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   127
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   128
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   129
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
   130
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
   131
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   132
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   133
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   134
  $ hg mv x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   135
  $ hg ci -m 'rename x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   136
  $ hg rm y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   137
  $ hg ci -qm 'remove y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   138
  $ echo x > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   139
  $ hg ci -Aqm 'add back y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   140
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   141
  @  3 add back y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   142
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   143
  o  2 remove y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   144
  |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   145
  o  1 rename x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   146
  |  x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   147
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   148
     x
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   149
  $ hg debugp1copies -r 3
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   150
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   151
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   152
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
   153
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
   154
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
   155
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   156
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   157
  $ echo x > x2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   158
  $ 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
   159
  $ hg cp x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   160
  $ hg ci -qm 'copy x to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   161
  $ hg rm z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   162
  $ hg ci -m 'remove z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   163
  $ hg cp x2 z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   164
  $ hg ci -m 'copy x2 to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   165
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   166
  @  3 copy x2 to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   167
  |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   168
  o  2 remove z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   169
  |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   170
  o  1 copy x to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   171
  |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   172
  o  0 add x and x2 with same content
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   173
     x x2
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   174
  $ hg debugp1copies -r 3
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   175
  x2 -> z
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   176
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   177
  x2 -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   178
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   179
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
   180
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   181
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   182
  $ echo y > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   183
  $ hg ci -Aqm 'add x and y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   184
  $ hg mv x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   185
  $ hg ci -qm 'rename x to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   186
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   187
  $ hg mv y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   188
  $ hg ci -qm 'rename y to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   189
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   190
  @  2 rename y to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   191
  |  y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   192
  | o  1 rename x to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   193
  |/   x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   194
  o  0 add x and y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   195
     x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   196
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   197
  z -> x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   198
  y -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   199
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   200
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
   201
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   202
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   203
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   204
  $ hg mv x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   205
  $ hg ci -m 'rename x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   206
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   207
  $ hg rm x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   208
  $ hg ci -m 'remove x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   209
  created new head
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   210
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   211
  @  2 remove x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   212
  |  x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   213
  | o  1 rename x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   214
  |/   x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   215
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   216
     x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   217
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   218
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   219
Copies via null revision (there shouldn't be any)
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   220
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   221
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   222
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   223
  $ hg cp x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   224
  $ hg ci -m 'copy x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   225
  $ hg co -q null
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   226
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   227
  $ hg ci -Aqm 'add x (again)'
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 add x (again)
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 copy x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   232
  |  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
  $ hg debugpathcopies 2 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   237
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   238
Merge rename from other branch
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   239
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   240
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   241
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   242
  $ hg mv x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   243
  $ hg ci -m 'rename x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   244
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   245
  $ echo z > z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   246
  $ hg ci -Aqm 'add z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   247
  $ hg merge -q 1
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   248
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   249
  $ hg debugp2copies
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   250
  $ hg ci -m 'merge rename from p2'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   251
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   252
  @    3 merge rename from p2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   253
  |\   x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   254
  | o  2 add z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   255
  | |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   256
  o |  1 rename x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   257
  |/   x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   258
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   259
     x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   260
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
   261
merges, so...
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   262
  $ hg debugp1copies -r 3
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   263
  $ hg debugp2copies -r 3
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   264
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   265
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   266
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   267
  y -> x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   268
  $ hg debugpathcopies 1 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   269
  $ hg debugpathcopies 2 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   270
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   271
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   272
Copy file from either side in a merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   273
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   274
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   275
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   276
  $ hg co -q null
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   277
  $ echo y > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   278
  $ hg ci -Aqm 'add y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   279
  $ hg merge -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   280
  $ hg cp y z
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   281
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   282
  y -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   283
  $ hg debugp2copies
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   284
  $ hg ci -m 'copy file from p1 in merge'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   285
  $ hg co -q 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   286
  $ hg merge -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   287
  $ hg cp x z
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   288
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   289
  $ hg debugp2copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   290
  x -> z
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   291
  $ hg ci -qm 'copy file from p2 in merge'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   292
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   293
  @    3 copy file from p2 in merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   294
  |\   z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   295
  +---o  2 copy file from p1 in merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   296
  | |/   z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   297
  | o  1 add y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   298
  |    y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   299
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   300
     x
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   301
  $ hg debugp1copies -r 2
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   302
  y -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   303
  $ hg debugp2copies -r 2
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   304
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   305
  y -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   306
  $ hg debugpathcopies 0 2
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   307
  $ hg debugp1copies -r 3
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   308
  $ hg debugp2copies -r 3
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   309
  x -> z
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   310
  $ hg debugpathcopies 1 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   311
  $ hg debugpathcopies 0 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   312
  x -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   313
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   314
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
   315
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   316
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   317
  $ hg ci -Aqm 'add x on branch 1'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   318
  $ hg co -q null
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   319
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   320
  $ hg ci -Aqm 'add x on branch 2'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   321
  $ hg merge -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   322
  $ hg cp x z
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   323
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   324
  x -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   325
  $ hg debugp2copies
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   326
  $ hg ci -qm 'merge'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   327
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   328
  @    2 merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   329
  |\   z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   330
  | o  1 add x on branch 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   331
  |    x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   332
  o  0 add x on branch 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   333
     x
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   334
  $ hg debugp1copies -r 2
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   335
  x -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   336
  $ hg debugp2copies -r 2
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   337
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
   338
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   339
  x -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   340
  $ hg debugpathcopies 0 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   341
  x -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   342
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   343
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
   344
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   345
  $ echo branch1 > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   346
  $ hg ci -Aqm 'add x on branch 1'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   347
  $ hg co -q null
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   348
  $ echo branch2 > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   349
  $ hg ci -Aqm 'add x on branch 2'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   350
  $ hg merge -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   351
  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
   352
  [1]
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   353
  $ echo resolved > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   354
  $ hg resolve -m x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   355
  (no more unresolved files)
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   356
  $ hg cp x z
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   357
  $ hg debugp1copies
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   358
  x -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   359
  $ hg debugp2copies
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   360
  $ hg ci -qm 'merge'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   361
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   362
  @    2 merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   363
  |\   x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   364
  | o  1 add x on branch 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   365
  |    x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   366
  o  0 add x on branch 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   367
     x
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   368
  $ hg debugp1copies -r 2
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   369
  $ hg debugp2copies -r 2
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   370
  x -> z
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   371
  $ hg debugpathcopies 1 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   372
  $ hg debugpathcopies 0 2
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   373
  x -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   374
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   375
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
   376
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
   377
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   378
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   379
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   380
  $ hg cp x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   381
  $ hg ci -qm 'copy x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   382
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   383
  $ hg cp x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   384
  $ hg ci -qm 'copy x to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   385
  $ hg merge -q 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   386
  $ 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
   387
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   388
  @    3 merge copy x->y and copy x->z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   389
  |\
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   390
  | o  2 copy x to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   391
  | |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   392
  o |  1 copy x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   393
  |/   y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   394
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   395
     x
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   396
  $ hg debugp1copies -r 3
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   397
  $ hg debugp2copies -r 3
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   398
  $ hg debugpathcopies 2 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   399
  x -> y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   400
  $ hg debugpathcopies 1 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   401
  x -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   402
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   403
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
   404
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
   405
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   406
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   407
  $ hg ci -Aqm 'add x'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   408
  $ hg cp x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   409
  $ hg ci -qm 'copy x to y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   410
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   411
  $ echo y > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   412
  $ hg ci -Aqm 'add y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   413
  $ hg mv y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   414
  $ hg ci -m 'rename y to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   415
  $ hg merge -q 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   416
  $ hg ci -m 'merge'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   417
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   418
  @    4 merge
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   419
  |\
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   420
  | o  3 rename y to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   421
  | |  y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   422
  | o  2 add y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   423
  | |  y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   424
  o |  1 copy x to y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   425
  |/   y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   426
  o  0 add x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   427
     x
41764
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   428
  $ hg debugp1copies -r 3
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   429
  y -> z
a4358f7345b4 context: introduce p[12]copies() methods and debugp[12]copies commands
Martin von Zweigbergk <martinvonz@google.com>
parents: 41763
diff changeset
   430
  $ hg debugp2copies -r 3
41760
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   431
  $ hg debugpathcopies 2 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   432
  y -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   433
  $ hg debugpathcopies 1 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   434
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   435
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
   436
other side.
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   437
  $ newrepo
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   438
  $ echo x > x
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   439
  $ echo y > y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   440
  $ hg ci -Aqm 'add x and y'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   441
  $ hg mv x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   442
  $ hg ci -qm 'rename x to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   443
  $ hg co -q 0
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   444
  $ hg mv y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   445
  $ hg ci -qm 'rename y to z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   446
  $ echo z >> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   447
  $ hg ci -m 'modify z'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   448
  $ hg merge -q 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   449
  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
   450
  [1]
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   451
  $ echo z > z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   452
  $ hg resolve -qm z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   453
  $ hg ci -m 'merge 1 into 3'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   454
Try merging the other direction too
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   455
  $ hg co -q 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   456
  $ hg merge -q 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   457
  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
   458
  [1]
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   459
  $ echo z > z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   460
  $ hg resolve -qm z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   461
  $ hg ci -m 'merge 3 into 1'
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   462
  created new head
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   463
  $ hg l
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   464
  @    5 merge 3 into 1
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   465
  |\   y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   466
  +---o  4 merge 1 into 3
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   467
  | |/   x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   468
  | o  3 modify z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   469
  | |  z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   470
  | o  2 rename y to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   471
  | |  y z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   472
  o |  1 rename x to z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   473
  |/   x z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   474
  o  0 add x and y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   475
     x y
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   476
  $ hg debugpathcopies 1 4
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   477
  $ hg debugpathcopies 2 4
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   478
  $ hg debugpathcopies 0 4
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   479
  x -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   480
  $ hg debugpathcopies 1 5
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   481
  $ hg debugpathcopies 2 5
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   482
  $ hg debugpathcopies 0 5
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   483
  x -> z
4ec0ce0fb929 tests: add tests of pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   484