Thanks Denis,

I see I was late to the party.

Maybe, once "experimental.updatecheck=noconflict" stabilizes, we could suggest "--merge" only if it is not going to cause a conflict.



On 10/05/2017 09:39 AM, Denis Laxalde wrote:
muxator via Mercurial-devel a écrit :

# HG changeset patch
# User muxator <a....@inwind.it>
# Date 1507151594 -7200
#      Wed Oct 04 23:13:14 2017 +0200
# Node ID fb134b55bce708f567cb4f32c0d96bb032c2651c
# Parent  c67db5dc131d0facdfdadc8c3344a8f3e689867d
ux: propose "hg update --merge" in the error message of a nonlinear dirty update

For the record, this has been proposed previously when the option got introduced. See https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-February/093128.html (follow replies for the rationale).

When trying an "hg update" of a dirty working copy across branches, mercurial
protects the user aborting with:
    abort: uncommitted changes
    (commit or update --clean to discard changes)

Since mercurial 4.2, however, it is possible to perform such updates invoking
"hg up --merge", but this is not signaled in the error message.

Only for these type of updates, this commit modifies the hint after the error
message to:
    abort: uncommitted changes
    (commit or update --merge to merge the changes. To discard the changes, update --clean)

The case in which the update is aborted due to conflicting changes keeps
printing the old error message:
   abort: conflicting changes
   (commit or update --clean to discard changes)

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1615,7 +1615,7 @@
                          pass # allow updating to successors
                      else:
                          msg = _("uncommitted changes")
-                        hint = _("commit or update --clean to discard changes") +                        hint = _("commit or update --merge to merge the changes. To discard the changes, update --clean")
                          raise error.UpdateAbort(msg, hint=hint)
                  else:
                      # Allow jumping branches if clean and specific rev given
diff --git a/tests/test-merge5.t b/tests/test-merge5.t
--- a/tests/test-merge5.t
+++ b/tests/test-merge5.t
@@ -26,7 +26,7 @@

    $ hg update 1
    abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to merge the changes. To discard the changes, update --clean)
    [255]
    $ mv c a

[...]
the same for the other tests (where applies: not for the "conflicting changes" case)
[...]



_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to