tests/test-merge-relaxed-block-sync.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Sun, 10 Nov 2024 00:59:43 +0100
branchstable
changeset 52233 e25e4647437b
parent 52081 a021da4ec509
permissions -rw-r--r--
wheel: build Windows wheels too Again, cibuildwheels makes it very handy.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52081
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
     1
==============================================
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
     2
Test merge algorithm with "relaxed block sync"
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
     3
==============================================
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
     4
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
     5
Setup
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
     6
=====
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
     7
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
     8
  $ cat >> $HGRCPATH << EOF
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
     9
  > [experimental]
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    10
  > relaxed-block-sync-merge=yes
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    11
  > [ui]
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    12
  > merge=:merge3
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    13
  > EOF
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    14
  $ unset HGMERGE
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    15
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    16
  $ hg init repo
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    17
  $ cd repo
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    18
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    19
  $ m=../scratch
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    20
  $ mkdir "$m"
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    21
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    22
# For the purpose of this test, we use a file [listing] that has one line
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    23
# per file of [scratch] directory.
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    24
# This way, the patches can be represented as bash scripts.
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    25
#
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    26
# Adding a line is then just "touch", removing a line is "rm", and
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    27
# modifying a line is "echo modfied > file1".
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    28
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    29
# Make_change takes a "patch script", as described above, and
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    30
# produces a file [listing] with the coresponding contents
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    31
# past applying the patch to a fixed base state.
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    32
  $ make_change() {
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    33
  >   cmd=$1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    34
  >    rm -r ../scratch
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    35
  >    mkdir ../scratch
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    36
  >    (cat listing 2>/dev/null || true) | while IFS=' :' read k v; do echo "$v" > ../scratch/"$k"; done
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    37
  >   
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    38
  >   (
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    39
  >    cd ../scratch
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    40
  >    eval "$cmd" >&2
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    41
  >    for f in *; do val=$(cat "$f"); printf "$f: $val\n"; done) > listing
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    42
  > }
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    43
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    44
# mk_rev takes a [base] and a patch, and produces a child revision of [base]
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    45
# corresponding to that patch.
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    46
  $ mk_rev() {
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    47
  >   base=$1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    48
  >   cmd=$2
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    49
  >   (hg update -C "$base" -q
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    50
  >   make_change "$cmd"
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    51
  >   (hg commit -qAm _ 2>&1) | grep -v 'commit already existed') >&2
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    52
  >   hg log -r . -T '{rev}'
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    53
  > }
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    54
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    55
  $ test() {
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    56
  >   cmd1=$1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    57
  >   cmd2=$2
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    58
  >   r2=$(mk_rev 0 "$cmd2")
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    59
  >   r1=$(mk_rev 0 "$cmd1")
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    60
  >   # already at r1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    61
  >   hg merge -q "$r2"
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    62
  >   cat listing
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    63
  > }
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    64
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    65
  $ rev0=$(mk_rev 'rev(-1)' 'echo val1 > key1; echo val2 > key2; echo val3 > key3; ')
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    66
  $ cat listing
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    67
  key1: val1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    68
  key2: val2
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    69
  key3: val3
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    70
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    71
Actual testing
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    72
==============
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    73
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    74
easy merge: no need for relaxed block sync:
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    75
-------------------------------------------
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    76
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    77
  $ test 'echo modified1 > key1' 'echo modified3 > key3'
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    78
  key1: modified1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    79
  key2: val2
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    80
  key3: modified3
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    81
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    82
Add adjacent to modify:
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    83
-----------------------
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    84
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    85
  $ test 'echo modified > key3' 'echo val4 > key4'
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    86
  key1: val1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    87
  key2: val2
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    88
  key3: modified
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    89
  key4: val4
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    90
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    91
Modify adjacent to modify:
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    92
--------------------------
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    93
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    94
  $ test 'echo modified3 > key3' 'echo modified2 > key2'
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    95
  key1: val1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    96
  key2: modified2
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    97
  key3: modified3
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    98
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
    99
Remove adjacent to modify:
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   100
--------------------------
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   101
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   102
  $ test 'rm key2' 'echo modified > key1'
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   103
  key1: modified
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   104
  key3: val3
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   105
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   106
Add adjacent to remove:
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   107
-----------------------
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   108
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   109
  $ test 'rm key2' 'touch key1a'
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   110
  key1: val1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   111
  key1a: 
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   112
  key3: val3
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   113
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   114
Remove adjacent to remove:
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   115
--------------------------
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   116
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   117
  $ test 'rm key2' 'rm key1'
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   118
  key3: val3
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   119
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   120
It even works if you're sandwiched between additions above and below:
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   121
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   122
  $ test 'echo val-changed-3 > key3' 'touch key2a; touch key4'
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   123
  key1: val1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   124
  key2: val2
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   125
  key2a: 
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   126
  key3: val-changed-3
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   127
  key4: 
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   128
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   129
Add adjacent to add:
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   130
--------------------
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   131
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   132
Add adjacent to add is still disallowed because we don't  know what order to add
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   133
lines in:
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   134
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   135
  $ test 'touch key1a' 'touch key1b'
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   136
  warning: conflicts while merging listing! (edit, then use 'hg resolve --mark')
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   137
  key1: val1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   138
  <<<<<<< working copy:    744662bcc33a - test: _
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   139
  key1a: 
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   140
  ||||||| common ancestor: b1791e356cd4 - test: _
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   141
  =======
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   142
  key1b: 
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   143
  >>>>>>> merge rev:       06735b47f956 - test: _
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   144
  key2: val2
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   145
  key3: val3
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   146
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   147
Add kinda-adjacent to add can still work if there's an
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   148
adjacent line that helps resolve the order ambiguity:
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   149
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   150
  $ test 'touch key1a; rm key2' 'touch key2a'
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   151
  key1: val1
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   152
  key1a: 
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   153
  key2a: 
a021da4ec509 merge: add a config to allow conflict-free merge of changes on adjacent lines
Arseniy Alekseyev <aalekseyev@janestreet.com
parents:
diff changeset
   154
  key3: val3