[PATCH] patch, i18n: avoid parameterized messages

Wagner Bruna wagner.bruna+mercurial at gmail.com
Thu Feb 18 13:43:18 CST 2010


# HG changeset patch
# User Wagner Bruna <wbruna at softwareexpress.com.br>
# Date 1266522163 7200
# Branch stable
# Node ID 2fe8f651debbe693c94d66422ed6708972c26826
# Parent  2c2d2f1354b44427976c2279e18d7c51a47a921b
patch, i18n: avoid parameterized messages

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -607,21 +607,27 @@
                         self.offset += len(newlines) - len(old)
                         self.skew = l - orig_start
                         self.dirty = 1
+                        offset = l - orig_start - fuzzlen
                         if fuzzlen:
-                            fuzzstr = "with fuzz %d " % fuzzlen
-                            f = self.ui.warn
+                            if offset == 1:
+                                msg = _("Hunk #%d succeeded at %d "
+                                        "with fuzz %d "
+                                        "(offset %d line).\n")
+                            else:
+                                msg = _("Hunk #%d succeeded at %d "
+                                        "with fuzz %d "
+                                        "(offset %d lines).\n")
                             self.printfile(True)
+                            self.ui.warn(msg %
+                                (h.number, l + 1, fuzzlen, offset))
                         else:
-                            fuzzstr = ""
-                            f = self.ui.note
-                        offset = l - orig_start - fuzzlen
-                        if offset == 1:
-                            msg = _("Hunk #%d succeeded at %d %s"
-                                    "(offset %d line).\n")
-                        else:
-                            msg = _("Hunk #%d succeeded at %d %s"
-                                    "(offset %d lines).\n")
-                        f(msg % (h.number, l + 1, fuzzstr, offset))
+                            if offset == 1:
+                                msg = _("Hunk #%d succeeded at %d "
+                                        "(offset %d line).\n")
+                            else:
+                                msg = _("Hunk #%d succeeded at %d "
+                                        "(offset %d lines).\n")
+                            self.ui.note(msg % (h.number, l + 1, offset))
                         return fuzzlen
         self.printfile(True)
         self.ui.warn(_("Hunk #%d FAILED at %d\n") % (h.number, orig_start))


More information about the Mercurial-devel mailing list