[PATCH V2] filemerge: store error messages in module variables

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH V2] filemerge: store error messages in module variables

Stanislau Hlebik
# HG changeset patch
# User Stanislau Hlebik <[hidden email]>
# Date 1495190863 25200
#      Fri May 19 03:47:43 2017 -0700
# Node ID 48651bcde6516d2bc075ce694a3d8b2fc0084e7b
# Parent  8a87bfc5bebbbe0ac996ac8e047a029eb931af45
filemerge: store error messages in module variables

Copytracing may be disabled because it's too slow (see
experimental.disablecopytrace config option). In that case user may get errors
like 'local changed FILE which other deleted'. It would be nice to give user a
hint to rerun command with `--config experimental.disablecopytrace=False`. To
make it possible let's extract error message to variables so that extension may
overwrite them.

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -49,6 +49,17 @@
 mergeonly = 'mergeonly'  # just the full merge, no premerge
 fullmerge = 'fullmerge'  # both premerge and merge
 
+_localchangedotherdeletedmsg = _(
+    "local%(l)s changed %(fd)s which other%(o)s deleted\n"
+    "use (c)hanged version, (d)elete, or leave (u)nresolved?"
+    "$$ &Changed $$ &Delete $$ &Unresolved")
+
+_otherchangedlocaldeletedmsg = _(
+    "other%(o)s changed %(fd)s which local%(l)s deleted\n"
+    "use (c)hanged version, leave (d)eleted, or "
+    "leave (u)nresolved?"
+    "$$ &Changed $$ &Deleted $$ &Unresolved")
+
 class absentfilectx(object):
     """Represents a file that's ostensibly in a context but is actually not
     present in it.
@@ -250,16 +261,11 @@
     try:
         if fco.isabsent():
             index = ui.promptchoice(
-                _("local%(l)s changed %(fd)s which other%(o)s deleted\n"
-                  "use (c)hanged version, (d)elete, or leave (u)nresolved?"
-                  "$$ &Changed $$ &Delete $$ &Unresolved") % prompts, 2)
+                _localchangedotherdeletedmsg % prompts, 2)
             choice = ['local', 'other', 'unresolved'][index]
         elif fcd.isabsent():
             index = ui.promptchoice(
-                _("other%(o)s changed %(fd)s which local%(l)s deleted\n"
-                  "use (c)hanged version, leave (d)eleted, or "
-                  "leave (u)nresolved?"
-                  "$$ &Changed $$ &Deleted $$ &Unresolved") % prompts, 2)
+                _otherchangedlocaldeletedmsg % prompts, 2)
             choice = ['other', 'local', 'unresolved'][index]
         else:
             index = ui.promptchoice(
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH V2] filemerge: store error messages in module variables

Yuya Nishihara
On Fri, 19 May 2017 03:52:57 -0700, Stanislau Hlebik wrote:
> # HG changeset patch
> # User Stanislau Hlebik <[hidden email]>
> # Date 1495190863 25200
> #      Fri May 19 03:47:43 2017 -0700
> # Node ID 48651bcde6516d2bc075ce694a3d8b2fc0084e7b
> # Parent  8a87bfc5bebbbe0ac996ac8e047a029eb931af45
> filemerge: store error messages in module variables

Seems fine. Queued, thanks.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel