tests/test-rename-merge1.t
author Martin von Zweigbergk <martinvonz@google.com>
Tue, 18 Jan 2022 13:05:21 -0800
changeset 49060 f3aafd785e65
parent 48472 38941a28406a
child 49266 ccd76e292be5
permissions -rw-r--r--
filemerge: add support for partial conflict resolution by external tool A common class of merge conflicts is in imports/#includes/etc. It's relatively easy to write a tool that can resolve these conflicts, perhaps by naively just unioning the statements and leaving any cleanup to other tools to do later [1]. Such specialized tools cannot generally resolve all conflicts in a file, of course. Let's therefore call them "partial merge tools". Note that the internal simplemerge algorithm is such a partial merge tool - one that only resolves trivial "conflicts" where one side is unchanged or both sides change in the same way. One can also imagine having smarter language-aware partial tools that merge the AST. It may be useful for such tools to interactively let the user resolve any conflicts it can't resolve itself. However, having the option of implementing it as a partial merge tool means that the developer doesn't *need* to create a UI for it. Instead, the user can resolve any remaining conflicts with their regular merge tool (e.g. `:merge3` or `meld). We don't currently have a way to let the user define such partial merge tools. That's what this patch addresses. It lets the user configure partial merge tools to run. Each tool can be configured to run only on files matching certain patterns (e.g. "*.py"). The tool takes three inputs (local, base, other) and resolves conflicts by updating these in place. For example, let's say the inputs are these: base: ``` import sys def main(): print('Hello') ``` local: ``` import os import sys def main(): print('Hi') ``` other: ``` import re import sys def main(): print('Howdy') ``` A partial merge tool could now resolve the conflicting imports by replacing the import statements in *all* files by the following snippet, while leaving the remainder of the files unchanged. ``` import os import re import sys ``` As a result, simplemerge and any regular merge tool that runs after the partial merge tool(s) will consider the imports to be non-conflicting and will only present the conflict in `main()` to the user. Differential Revision: https://phab.mercurial-scm.org/D12356
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12298
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
     1
  $ hg init
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
     2
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
     3
  $ echo "[merge]" >> .hg/hgrc
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
     4
  $ echo "followcopies = 1" >> .hg/hgrc
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
     5
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
     6
  $ echo foo > a
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
     7
  $ echo foo > a2
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
     8
  $ hg add a a2
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
     9
  $ hg ci -m "start"
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    10
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    11
  $ hg mv a b
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    12
  $ hg mv a2 b2
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    13
  $ hg ci -m "rename"
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    14
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    15
  $ hg co 0
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    16
  2 files updated, 0 files merged, 2 files removed, 0 files unresolved
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    17
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    18
  $ echo blahblah > a
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    19
  $ echo blahblah > a2
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    20
  $ hg mv a2 c2
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    21
  $ hg ci -m "modify"
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    22
  created new head
3153
c82ea81d6850 Add core copy detection algorithm
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    23
12298
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    24
  $ hg merge -y --debug
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    25
    unmatched files in local:
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    26
     c2
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    27
    unmatched files in other:
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    28
     b
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    29
     b2
16795
e9ae770eff1c merge: show renamed on one and deleted on the other side in debug output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16794
diff changeset
    30
    all copies found (* = to merge, ! = divergent, % = renamed and deleted):
44272
17e12938f8e7 copies: print debug information about copies per side/branch
Martin von Zweigbergk <martinvonz@google.com>
parents: 44265
diff changeset
    31
     on local side:
17e12938f8e7 copies: print debug information about copies per side/branch
Martin von Zweigbergk <martinvonz@google.com>
parents: 44265
diff changeset
    32
      src: 'a2' -> dst: 'c2' !
17e12938f8e7 copies: print debug information about copies per side/branch
Martin von Zweigbergk <martinvonz@google.com>
parents: 44265
diff changeset
    33
     on remote side:
17e12938f8e7 copies: print debug information about copies per side/branch
Martin von Zweigbergk <martinvonz@google.com>
parents: 44265
diff changeset
    34
      src: 'a' -> dst: 'b' *
17e12938f8e7 copies: print debug information about copies per side/branch
Martin von Zweigbergk <martinvonz@google.com>
parents: 44265
diff changeset
    35
      src: 'a2' -> dst: 'b2' !
12298
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    36
    checking for directory renames
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    37
  resolving manifests
18605
bcf29565d89f manifestmerge: pass in branchmerge and force separately
Siddharth Agarwal <sid0@fb.com>
parents: 18541
diff changeset
    38
   branchmerge: True, force: False, partial: False
15625
efdcce3fd2d5 merge: make debug output easier to read
Martin Geisler <mg@aragost.com>
parents: 14182
diff changeset
    39
   ancestor: af1939970a1c, local: 044f8520aeeb+, remote: 85c198ef2f6c
26957
d16d73173fdd merge: move messages about possible conflicts a litte earlier
Martin von Zweigbergk <martinvonz@google.com>
parents: 26618
diff changeset
    40
  note: possible conflict - a2 was renamed multiple times to:
42110
3a7efcbdf288 copies: print list of divergent renames in sorted order
Martin von Zweigbergk <martinvonz@google.com>
parents: 37285
diff changeset
    41
   b2
26957
d16d73173fdd merge: move messages about possible conflicts a litte earlier
Martin von Zweigbergk <martinvonz@google.com>
parents: 26618
diff changeset
    42
   c2
45499
c4f14db3da1d merge: move initial handling of mergeactions near to later one
Pulkit Goyal <7895pulkit@gmail.com>
parents: 44299
diff changeset
    43
   b2: remote created -> g
c4f14db3da1d merge: move initial handling of mergeactions near to later one
Pulkit Goyal <7895pulkit@gmail.com>
parents: 44299
diff changeset
    44
  getting b2
21391
cb15835456cb merge: change debug logging - test output changes but no real changes
Mads Kiilerich <madski@unity3d.com>
parents: 21389
diff changeset
    45
   preserving a for resolve of b
cb15835456cb merge: change debug logging - test output changes but no real changes
Mads Kiilerich <madski@unity3d.com>
parents: 21389
diff changeset
    46
  removing a
48472
38941a28406a mergestate: merge `preresolve()` into `resolve()`
Martin von Zweigbergk <martinvonz@google.com>
parents: 46076
diff changeset
    47
   b: remote moved from a -> m
27161
296d55def9c4 filemerge: add debug output for whether this is a change/delete conflict
Siddharth Agarwal <sid0@fb.com>
parents: 26957
diff changeset
    48
  picked tool ':merge' for b (binary False symlink False changedelete False)
12298
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    49
  merging a and b to b
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    50
  my b@044f8520aeeb+ other b@85c198ef2f6c ancestor a@af1939970a1c
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    51
   premerge successful
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    52
  1 files updated, 1 files merged, 0 files removed, 0 files unresolved
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    53
  (branch merge, don't forget to commit)
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    54
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    55
  $ hg status -AC
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    56
  M b
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    57
    a
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    58
  M b2
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    59
  R a
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    60
  C c2
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    61
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    62
  $ cat b
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    63
  blahblah
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    64
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    65
  $ hg ci -m "merge"
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    66
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 13537
diff changeset
    67
  $ hg debugindex b
37285
d4e62df1c73d debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37284
diff changeset
    68
     rev linkrev nodeid       p1           p2
d4e62df1c73d debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37284
diff changeset
    69
       0       1 57eacc201a7f 000000000000 000000000000
d4e62df1c73d debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37284
diff changeset
    70
       1       3 4727ba907962 000000000000 57eacc201a7f
12298
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    71
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    72
  $ hg debugrename b
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    73
  b renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66
f254204d8b8d tests: unify test-rename-merge1
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
    74
12683
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    75
This used to trigger a "divergent renames" warning, despite no renames
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    76
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    77
  $ hg cp b b3
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    78
  $ hg cp b b4
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    79
  $ hg ci -A -m 'copy b twice'
42220
fad480dad04d tests: avoid cryptic nodeids in tests/test-rename-merge1.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42209
diff changeset
    80
  $ hg up '.^'
12683
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    81
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    82
  $ hg up
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    83
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    84
  $ hg rm b3 b4
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    85
  $ hg ci -m 'clean up a bit of our mess'
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    86
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    87
We'd rather not warn on divergent renames done in the same changeset (issue2113)
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    88
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    89
  $ hg cp b b3
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    90
  $ hg mv b b4
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    91
  $ hg ci -A -m 'divergent renames in same changeset'
42220
fad480dad04d tests: avoid cryptic nodeids in tests/test-rename-merge1.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42209
diff changeset
    92
  $ hg up '.^'
12683
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    93
  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    94
  $ hg up
ada47c38f4e5 copies: don't detect copies as "divergent renames"
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12298
diff changeset
    95
  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
13468
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
    96
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
    97
Check for issue2642
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
    98
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
    99
  $ hg init t
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   100
  $ cd t
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   101
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   102
  $ echo c0 > f1
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   103
  $ hg ci -Aqm0
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   104
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   105
  $ hg up null -q
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   106
  $ echo c1 > f1 # backport
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   107
  $ hg ci -Aqm1
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   108
  $ hg mv f1 f2
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   109
  $ hg ci -qm2
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   110
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   111
  $ hg up 0 -q
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   112
  $ hg merge 1 -q --tool internal:local
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   113
  $ hg ci -qm3
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   114
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   115
  $ hg merge 2
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   116
  merging f1 and f2 to f2
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   117
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   118
  (branch merge, don't forget to commit)
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   119
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   120
  $ cat f2
d100702326d5 context: generate file ancestors in reverse revision order (issue2642)
Matt Mackall <mpm@selenic.com>
parents: 12757
diff changeset
   121
  c0
13492
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   122
16793
9cbc44a6600e tests: do not create repos inside repos in test-rename-merge1.t
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16792
diff changeset
   123
  $ cd ..
9cbc44a6600e tests: do not create repos inside repos in test-rename-merge1.t
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16792
diff changeset
   124
13492
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   125
Check for issue2089
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   126
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   127
  $ hg init repo2089
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   128
  $ cd repo2089
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   129
13537
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   130
  $ echo c0 > f1
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   131
  $ hg ci -Aqm0
13492
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   132
13537
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   133
  $ hg up null -q
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   134
  $ echo c1 > f1
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   135
  $ hg ci -Aqm1
13492
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   136
13537
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   137
  $ hg up 0 -q
13492
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   138
  $ hg merge 1 -q --tool internal:local
13537
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   139
  $ echo c2 > f1
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   140
  $ hg ci -qm2
13492
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   141
13537
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   142
  $ hg up 1 -q
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   143
  $ hg mv f1 f2
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   144
  $ hg ci -Aqm3
13492
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   145
13537
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   146
  $ hg up 2 -q
13492
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   147
  $ hg merge 3
13537
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   148
  merging f1 and f2 to f2
13492
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   149
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   150
  (branch merge, don't forget to commit)
ca940d06bf95 tests: test renaming a file added on two branches (issue2089)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13468
diff changeset
   151
13537
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   152
  $ cat f2
37f487b9fbcc test-rename-merge1: make it easier to review, windows friendly
Patrick Mezard <pmezard@gmail.com>
parents: 13492
diff changeset
   153
  c2
16793
9cbc44a6600e tests: do not create repos inside repos in test-rename-merge1.t
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16792
diff changeset
   154
9cbc44a6600e tests: do not create repos inside repos in test-rename-merge1.t
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16792
diff changeset
   155
  $ cd ..
16794
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   156
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   157
Check for issue3074
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   158
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   159
  $ hg init repo3074
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   160
  $ cd repo3074
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   161
  $ echo foo > file
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   162
  $ hg add file
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   163
  $ hg commit -m "added file"
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   164
  $ hg mv file newfile
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   165
  $ hg commit -m "renamed file"
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   166
  $ hg update 0
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   167
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   168
  $ hg rm file
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   169
  $ hg commit -m "deleted file"
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   170
  created new head
16795
e9ae770eff1c merge: show renamed on one and deleted on the other side in debug output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16794
diff changeset
   171
  $ hg merge --debug
e9ae770eff1c merge: show renamed on one and deleted on the other side in debug output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16794
diff changeset
   172
    unmatched files in other:
e9ae770eff1c merge: show renamed on one and deleted on the other side in debug output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16794
diff changeset
   173
     newfile
e9ae770eff1c merge: show renamed on one and deleted on the other side in debug output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16794
diff changeset
   174
    all copies found (* = to merge, ! = divergent, % = renamed and deleted):
44272
17e12938f8e7 copies: print debug information about copies per side/branch
Martin von Zweigbergk <martinvonz@google.com>
parents: 44265
diff changeset
   175
     on remote side:
17e12938f8e7 copies: print debug information about copies per side/branch
Martin von Zweigbergk <martinvonz@google.com>
parents: 44265
diff changeset
   176
      src: 'file' -> dst: 'newfile' %
16795
e9ae770eff1c merge: show renamed on one and deleted on the other side in debug output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16794
diff changeset
   177
    checking for directory renames
e9ae770eff1c merge: show renamed on one and deleted on the other side in debug output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16794
diff changeset
   178
  resolving manifests
18605
bcf29565d89f manifestmerge: pass in branchmerge and force separately
Siddharth Agarwal <sid0@fb.com>
parents: 18541
diff changeset
   179
   branchmerge: True, force: False, partial: False
16795
e9ae770eff1c merge: show renamed on one and deleted on the other side in debug output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16794
diff changeset
   180
   ancestor: 19d7f95df299, local: 0084274f6b67+, remote: 5d32493049f0
26957
d16d73173fdd merge: move messages about possible conflicts a litte earlier
Martin von Zweigbergk <martinvonz@google.com>
parents: 26618
diff changeset
   181
  note: possible conflict - file was deleted and renamed to:
d16d73173fdd merge: move messages about possible conflicts a litte earlier
Martin von Zweigbergk <martinvonz@google.com>
parents: 26618
diff changeset
   182
   newfile
21389
e741972017d9 merge: change priority / ordering of merge actions
Mads Kiilerich <madski@unity3d.com>
parents: 20945
diff changeset
   183
   newfile: remote created -> g
18631
e2dc5397bc82 tests: update test output (will be folded into parent)
Bryan O'Sullivan <bryano@fb.com>
parents: 18605
diff changeset
   184
  getting newfile
16794
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   185
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   186
  (branch merge, don't forget to commit)
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   187
  $ hg status
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   188
  M newfile
98687cdddcb1 merge: warn about file deleted in one branch and renamed in other (issue3074)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16793
diff changeset
   189
  $ cd ..
44241
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   190
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   191
Create x and y, then modify y and rename x to z on one side of merge, and
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   192
modify x and rename y to z on the other side.
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   193
  $ hg init conflicting-target
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   194
  $ cd conflicting-target
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   195
  $ echo x > x
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   196
  $ echo y > y
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   197
  $ hg ci -Aqm 'add x and y'
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   198
  $ hg mv x z
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   199
  $ echo foo >> y
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   200
  $ hg ci -qm 'modify y, rename x to z'
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   201
  $ hg co -q 0
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   202
  $ hg mv y z
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   203
  $ echo foo >> x
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   204
  $ hg ci -qm 'modify x, rename y to z'
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   205
# We should probably tell the user about the conflicting rename sources.
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   206
# Depending on which side they pick, we should take that rename and get
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   207
# the changes to the source from the other side. The unchanged file should
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   208
# remain.
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   209
  $ hg merge --debug 1 -t :merge3
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   210
    all copies found (* = to merge, ! = divergent, % = renamed and deleted):
44272
17e12938f8e7 copies: print debug information about copies per side/branch
Martin von Zweigbergk <martinvonz@google.com>
parents: 44265
diff changeset
   211
     on local side:
44299
b4057d001760 merge: when rename was made on both sides, use ancestor as merge base
Martin von Zweigbergk <martinvonz@google.com>
parents: 44272
diff changeset
   212
      src: 'y' -> dst: 'z' *
44272
17e12938f8e7 copies: print debug information about copies per side/branch
Martin von Zweigbergk <martinvonz@google.com>
parents: 44265
diff changeset
   213
     on remote side:
44299
b4057d001760 merge: when rename was made on both sides, use ancestor as merge base
Martin von Zweigbergk <martinvonz@google.com>
parents: 44272
diff changeset
   214
      src: 'x' -> dst: 'z' *
44241
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   215
    checking for directory renames
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   216
  resolving manifests
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   217
   branchmerge: True, force: False, partial: False
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   218
   ancestor: 5151c134577e, local: 07fcbc9a74ed+, remote: f21419739508
46076
69429972ff1f tests: correct the output order about starting a background thread for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 45499
diff changeset
   219
  starting 4 threads for background file closing (?)
44241
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   220
   preserving z for resolve of z
48472
38941a28406a mergestate: merge `preresolve()` into `resolve()`
Martin von Zweigbergk <martinvonz@google.com>
parents: 46076
diff changeset
   221
   z: both renamed from y -> m
44241
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   222
  picked tool ':merge3' for z (binary False symlink False changedelete False)
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   223
  merging z
44299
b4057d001760 merge: when rename was made on both sides, use ancestor as merge base
Martin von Zweigbergk <martinvonz@google.com>
parents: 44272
diff changeset
   224
  my z@07fcbc9a74ed+ other z@f21419739508 ancestor y@5151c134577e
b4057d001760 merge: when rename was made on both sides, use ancestor as merge base
Martin von Zweigbergk <martinvonz@google.com>
parents: 44272
diff changeset
   225
   premerge successful
b4057d001760 merge: when rename was made on both sides, use ancestor as merge base
Martin von Zweigbergk <martinvonz@google.com>
parents: 44272
diff changeset
   226
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
b4057d001760 merge: when rename was made on both sides, use ancestor as merge base
Martin von Zweigbergk <martinvonz@google.com>
parents: 44272
diff changeset
   227
  (branch merge, don't forget to commit)
44241
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   228
  $ ls
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   229
  x
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   230
  z
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   231
  $ cat x
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   232
  x
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   233
  foo
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   234
# 'z' should have had the added 'foo' line
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   235
  $ cat z
d7622fdec3b5 tests: test merge of renames of different sources to same target
Martin von Zweigbergk <martinvonz@google.com>
parents: 42590
diff changeset
   236
  x