view tests/test-merge-halt.t @ 46858:85e3a630cad9

revlog: move the details of revlog "v2" index inside revlog.utils.constants the revlog module is quite large and this kind of format information would handy for other module. So let us start to gather this information about the format in a more appropriate place. We update various reference to this information to use the new "source of truth" in the process. Differential Revision: https://phab.mercurial-scm.org/D10305
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 05 Apr 2021 12:21:12 +0200
parents 21733e8c924f
children 3e66e4517744
line wrap: on
line source

  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > rebase=
  > [phases]
  > publish=False
  > [merge]
  > EOF

  $ hg init repo
  $ cd repo
  $ echo a > a
  $ echo b > b
  $ hg commit -qAm ab
  $ echo c >> a
  $ echo c >> b
  $ hg commit -qAm c
  $ hg up -q ".^"
  $ echo d >> a
  $ echo d >> b
  $ hg commit -qAm d

Testing on-failure=continue
  $ echo on-failure=continue >> $HGRCPATH
  $ hg rebase -s 1 -d 2 --tool false
  rebasing 1:1f28a51c3c9b "c"
  merging a
  merging b
  merging a failed!
  merging b failed!
  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
  [240]

  $ hg resolve --list
  U a
  U b

  $ hg rebase --abort
  rebase aborted

Testing on-failure=halt
  $ echo on-failure=halt >> $HGRCPATH
  $ hg rebase -s 1 -d 2 --tool false
  rebasing 1:1f28a51c3c9b "c"
  merging a
  merging b
  merging a failed!
  merge halted after failed merge (see hg resolve)
  [240]

  $ hg resolve --list
  U a
  U b

  $ hg rebase --abort
  rebase aborted

Testing on-failure=prompt
  $ cat <<EOS >> $HGRCPATH
  > [merge]
  > on-failure=prompt
  > [ui]
  > interactive=1
  > EOS
  $ cat <<EOS | hg rebase -s 1 -d 2 --tool false
  > y
  > n
  > EOS
  rebasing 1:1f28a51c3c9b "c"
  merging a
  merging b
  merging a failed!
  continue merge operation (yn)? y
  merging b failed!
  continue merge operation (yn)? n
  merge halted after failed merge (see hg resolve)
  [240]

  $ hg resolve --list
  U a
  U b

  $ hg rebase --abort
  rebase aborted

Check that successful tool with failed post-check halts the merge
  $ cat <<EOS >> $HGRCPATH
  > [merge-tools]
  > true.check=changed
  > EOS
  $ cat <<EOS | hg rebase -s 1 -d 2 --tool true
  > y
  > n
  > n
  > EOS
  rebasing 1:1f28a51c3c9b "c"
  merging a
  merging b
   output file a appears unchanged
  was merge successful (yn)? y
   output file b appears unchanged
  was merge successful (yn)? n
  merging b failed!
  continue merge operation (yn)? n
  merge halted after failed merge (see hg resolve)
  [240]

  $ hg resolve --list
  R a
  U b

  $ hg rebase --abort
  rebase aborted

Check that conflicts with conflict check also halts the merge
  $ cat <<EOS >> $HGRCPATH
  > [merge-tools]
  > true.check=conflicts
  > true.premerge=keep
  > [merge]
  > on-failure=halt
  > EOS
  $ hg rebase -s 1 -d 2 --tool true
  rebasing 1:1f28a51c3c9b "c"
  merging a
  merging b
  merging a failed!
  merge halted after failed merge (see hg resolve)
  [240]

  $ hg resolve --list
  U a
  U b

  $ hg rebase --abort
  rebase aborted

Check that always-prompt also can halt the merge
  $ cat <<EOS | hg rebase -s 1 -d 2 --tool true --config merge-tools.true.check=prompt
  > y
  > n
  > EOS
  rebasing 1:1f28a51c3c9b "c"
  merging a
  merging b
  was merge of 'a' successful (yn)? y
  was merge of 'b' successful (yn)? n
  merging b failed!
  merge halted after failed merge (see hg resolve)
  [240]

  $ hg resolve --list
  R a
  U b

  $ hg rebase --abort
  rebase aborted

Check that successful tool otherwise allows the merge to continue
  $ hg rebase -s 1 -d 2 --tool echo --keep --config merge-tools.echo.premerge=keep
  rebasing 1:1f28a51c3c9b "c"
  merging a
  merging b
  $TESTTMP/repo/a *a~base* *a~other* (glob)
  $TESTTMP/repo/b *b~base* *b~other* (glob)