tests/test-merge-halt.t
author Ryan McElroy <rmcelroy@fb.com>
Fri, 06 Oct 2017 06:48:43 -0700
changeset 34797 284fa44f7f39
parent 34679 143337bcec9b
child 34884 05535d0dea68
permissions -rw-r--r--
merge: allow user to halt merge on merge-tool failures Depends on D932. Call the new _onfilemergefailure function when a merge tool reports failure via a return code. Differential Revision: https://phab.mercurial-scm.org/D951
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34679
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     1
  $ cat >> $HGRCPATH <<EOF
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     2
  > [extensions]
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     3
  > rebase=
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     4
  > [phases]
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     5
  > publish=False
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     6
  > [merge]
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     7
  > EOF
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     8
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     9
  $ hg init repo
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    10
  $ cd repo
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    11
  $ echo a > a
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    12
  $ echo b > b
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    13
  $ hg commit -qAm ab
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    14
  $ echo c >> a
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    15
  $ echo c >> b
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    16
  $ hg commit -qAm c
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    17
  $ hg up -q ".^"
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    18
  $ echo d >> a
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    19
  $ echo d >> b
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    20
  $ hg commit -qAm d
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    21
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    22
Testing on-failure=continue
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    23
  $ echo on-failure=continue >> $HGRCPATH
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    24
  $ hg rebase -s 1 -d 2 --tool false
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    25
  rebasing 1:1f28a51c3c9b "c"
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    26
  merging a
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    27
  merging b
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    28
  merging a failed!
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    29
  merging b failed!
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    30
  unresolved conflicts (see hg resolve, then hg rebase --continue)
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    31
  [1]
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    32
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    33
  $ hg resolve --list
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    34
  U a
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    35
  U b
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    36
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    37
  $ hg rebase --abort
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    38
  rebase aborted
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    39
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    40
Testing on-failure=halt
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    41
  $ echo on-failure=halt >> $HGRCPATH
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    42
  $ hg rebase -s 1 -d 2 --tool false
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    43
  rebasing 1:1f28a51c3c9b "c"
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    44
  merging a
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    45
  merging b
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    46
  merging a failed!
34797
284fa44f7f39 merge: allow user to halt merge on merge-tool failures
Ryan McElroy <rmcelroy@fb.com>
parents: 34679
diff changeset
    47
  merge halted after failed merge (see hg resolve)
34679
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    48
  [1]
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    49
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    50
  $ hg resolve --list
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    51
  U a
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    52
  U b
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    53
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    54
  $ hg rebase --abort
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    55
  rebase aborted
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    56
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    57
Testing on-failure=prompt
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    58
  $ echo on-failure=prompt >> $HGRCPATH
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    59
  $ cat <<EOS | hg rebase -s 1 -d 2 --tool false --config ui.interactive=1
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    60
  > y
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    61
  > n
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    62
  > EOS
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    63
  rebasing 1:1f28a51c3c9b "c"
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    64
  merging a
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    65
  merging b
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    66
  merging a failed!
34797
284fa44f7f39 merge: allow user to halt merge on merge-tool failures
Ryan McElroy <rmcelroy@fb.com>
parents: 34679
diff changeset
    67
  continue merge operation (yn)? y
34679
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    68
  merging b failed!
34797
284fa44f7f39 merge: allow user to halt merge on merge-tool failures
Ryan McElroy <rmcelroy@fb.com>
parents: 34679
diff changeset
    69
  continue merge operation (yn)? n
284fa44f7f39 merge: allow user to halt merge on merge-tool failures
Ryan McElroy <rmcelroy@fb.com>
parents: 34679
diff changeset
    70
  merge halted after failed merge (see hg resolve)
34679
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    71
  [1]
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    72
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    73
  $ hg resolve --list
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    74
  U a
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    75
  U b
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    76
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    77
  $ hg rebase --abort
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    78
  rebase aborted
143337bcec9b merge: add tests to show current behavior on failed filemerges
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    79