[PATCH stable] patch, i18n: avoid parameterized messages

Wagner Bruna wagner.bruna+mercurial at gmail.com
Fri Feb 19 09:06:20 CST 2010


# HG changeset patch
# User Wagner Bruna <wbruna at softwareexpress.com.br>
# Date 1266591851 7200
# Branch stable
# Node ID 7d51c2b0877ec3469bd405a1372690f2b0f70125
# Parent  6f61c480f51c970d3e0cb0d6862e5e3c3784303c
patch, i18n: avoid parameterized messages

Singular message removed for simplicity.

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -607,21 +607,18 @@
                         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
+                            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"
+                            msg = _("Hunk #%d succeeded at %d "
                                     "(offset %d lines).\n")
-                        f(msg % (h.number, l + 1, fuzzstr, offset))
+                            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