diff tests/test-update-branches.t @ 37920:ea63a2004d09

update: print warning about hidden changeset after update When an attempt to update to a hidden changeset fails because the working copy is dirty, you may get a message like this: updating to a hidden changeset 343f6de32686 (hidden revision '343f6de32686' was rewritten as: 4ab941244072) abort: conflicting changes (commit or update --clean to discard changes) It's easy to miss the real error here. This patch moves the warning about the hidden changeset to after the update has happened. It changes the verb tense accordingly (and drops the "a" that I think it sounds better without). Of course, this means that the commit isn't actually hidden anymore when the message is printed. I think that's fine. Differential Revision: https://phab.mercurial-scm.org/D3479
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 07 May 2018 19:43:43 -0700
parents 35a0f6f31eef
children 34a46d48d24e
line wrap: on
line diff
--- a/tests/test-update-branches.t	Fri Apr 27 01:35:00 2018 -0400
+++ b/tests/test-update-branches.t	Mon May 07 19:43:43 2018 -0700
@@ -516,11 +516,33 @@
   $ hg bookmarks
    * bm                        5:ff252e8273df
 
+Test that we abort before we warn about the hidden commit if the working
+directory is dirty
+  $ echo conflict > a
+  $ hg up --hidden 3
+  abort: uncommitted changes
+  (commit or update --clean to discard changes)
+  [255]
+
+Test that we still warn also when there are conflicts
+  $ hg up -m --hidden 3
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+  (leaving bookmark bm)
+  updated to hidden changeset 6efa171f091b
+  (hidden revision '6efa171f091b' was rewritten as: d047485b3896)
+  [1]
+  $ hg revert -r . a
+  $ hg resolve -m
+  (no more unresolved files)
+
 Test that 4 is detected as the no-argument destination from 3 and also moves
 the bookmark with it
   $ hg up --quiet 0          # we should be able to update to 3 directly
   $ hg up --quiet --hidden 3 # but not implemented yet.
-  updating to a hidden changeset 6efa171f091b
+  updated to hidden changeset 6efa171f091b
   (hidden revision '6efa171f091b' was rewritten as: d047485b3896)
   $ hg book -f bm
   $ hg up
@@ -532,7 +554,7 @@
 Test that 5 is detected as a valid destination from 1
   $ hg up --quiet 0          # we should be able to update to 3 directly
   $ hg up --quiet --hidden 3 # but not implemented yet.
-  updating to a hidden changeset 6efa171f091b
+  updated to hidden changeset 6efa171f091b
   (hidden revision '6efa171f091b' was rewritten as: d047485b3896)
   $ hg up 5
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved