view tests/test-confused-revert.t @ 29774:a7f8939641aa

merge: use labels in prompts to the user Now that we persist the labels, we can consistently use the labels in prompts for the user without risk of confusion. This changes a huge amount of command output: This means that merge prompts like: no tool found to merge a keep (l)ocal, take (o)ther, or leave (u)nresolved? u and remote changed a which local deleted use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c become: no tool found to merge a keep (l)ocal [working copy], take (o)ther [destination], or leave (u)nresolved? u and remote [source] changed a which local [dest] deleted use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c where "working copy" and "destination" were supplied by the command that requested the merge as labels for conflict markers, and thus should be human-friendly.
author Simon Farnsworth <simonfar@fb.com>
date Fri, 12 Aug 2016 06:01:42 -0700
parents fc1d75e7a98d
children cb70501d8b71
line wrap: on
line source

  $ hg init
  $ echo foo > a
  $ hg add a
  $ hg commit -m "1"

  $ echo bar > b
  $ hg add b
  $ hg remove a

Should show a removed and b added:

  $ hg status
  A b
  R a

  $ hg revert --all
  undeleting a
  forgetting b

Should show b unknown and a back to normal:

  $ hg status
  ? b

  $ rm b

  $ hg co -C 0
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo foo-a > a
  $ hg commit -m "2a"

  $ hg co -C 0
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo foo-b > a
  $ hg commit -m "2b"
  created new head

  $ HGMERGE=true hg merge 1
  merging a
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)

Should show foo-b:

  $ cat a
  foo-b

  $ echo bar > b
  $ hg add b
  $ rm a
  $ hg remove a

Should show a removed and b added:

  $ hg status
  A b
  R a

Revert should fail:

  $ hg revert
  abort: uncommitted merge with no revision specified
  (use 'hg update' or see 'hg help revert')
  [255]

Revert should be ok now:

  $ hg revert -r2 --all
  undeleting a
  forgetting b

Should show b unknown and a marked modified (merged):

  $ hg status
  M a
  ? b

Should show foo-b:

  $ cat a
  foo-b