tests/test-merge9.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 05 Apr 2024 11:33:47 +0200
changeset 51580 b70628a9aa7e
parent 48427 38941a28406a
permissions -rw-r--r--
phases: use revision number in new_heads All graph operations will be done using revision numbers, so passing nodes only means they will eventually get converted to revision numbers internally. As part of an effort to align the code on using revision number we make the `phases.newheads` function operated on revision number, taking them as input and using them in returns, instead of the node-id it used to consume and produce. This is part of multiple changesets effort to translate more part of the logic, but is done step by step to facilitate the identification of issue that might arise in mercurial core and extensions. To make the change simpler to handle for third party extensions, we also rename the function, using a more modern form. This will help detecting the different between the node-id version and the rev-num version. I also take this as an opportunity to add some comment about possible performance improvement for the future. They don't matter too much now, but they are worse exploring in a while.

test that we don't interrupt the merge session if
a file-level merge failed

  $ hg init repo
  $ cd repo

  $ echo foo > foo
  $ echo a > bar
  $ hg ci -Am 'add foo'
  adding bar
  adding foo

  $ hg mv foo baz
  $ echo b >> bar
  $ echo quux > quux1
  $ hg ci -Am 'mv foo baz'
  adding quux1

  $ hg up -qC 0
  $ echo >> foo
  $ echo c >> bar
  $ echo quux > quux2
  $ hg ci -Am 'change foo'
  adding quux2
  created new head

test with the rename on the remote side
  $ HGMERGE=false hg merge
  merging bar
  merging bar failed!
  merging foo and baz to baz
  1 files updated, 1 files merged, 0 files removed, 1 files unresolved
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
  [1]
  $ hg resolve -l
  U bar
  R baz

test with the rename on the local side
  $ hg up -C 1
  3 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ HGMERGE=false hg merge
  merging bar
  merging bar failed!
  merging baz and foo to baz
  1 files updated, 1 files merged, 0 files removed, 1 files unresolved
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
  [1]

show unresolved
  $ hg resolve -l
  U bar
  R baz

unmark baz
  $ hg resolve -u baz

show
  $ hg resolve -l
  U bar
  U baz
  $ hg st
  M bar
  M baz
  M quux2
  ? bar.orig

re-resolve baz
  $ hg resolve baz
  merging baz and foo to baz

after resolve
  $ hg resolve -l
  U bar
  R baz

resolve all warning
  $ hg resolve
  abort: no files or directories specified
  (use --all to re-merge all unresolved files)
  [10]

resolve all
  $ hg resolve -a
  merging bar
  warning: conflicts while merging bar! (edit, then use 'hg resolve --mark')
  [1]

after
  $ hg resolve -l
  U bar
  R baz

  $ cd ..