##// END OF EJS Templates
cmdutil: handle multiline translations of HG: messages safely...
timeless@mozdev.org -
r26426:0486c16c default
parent child Browse files
Show More
@@ -2735,6 +2735,9 b' def buildcommittemplate(repo, ctx, subs,'
2735 t.show(ctx, extramsg=extramsg)
2735 t.show(ctx, extramsg=extramsg)
2736 return ui.popbuffer()
2736 return ui.popbuffer()
2737
2737
2738 def hgprefix(msg):
2739 return "\n".join(["HG: %s" % a for a in msg.split("\n") if a])
2740
2738 def buildcommittext(repo, ctx, subs, extramsg):
2741 def buildcommittext(repo, ctx, subs, extramsg):
2739 edittext = []
2742 edittext = []
2740 modified, added, removed = ctx.modified(), ctx.added(), ctx.removed()
2743 modified, added, removed = ctx.modified(), ctx.added(), ctx.removed()
@@ -2742,23 +2745,23 b' def buildcommittext(repo, ctx, subs, ext'
2742 edittext.append(ctx.description())
2745 edittext.append(ctx.description())
2743 edittext.append("")
2746 edittext.append("")
2744 edittext.append("") # Empty line between message and comments.
2747 edittext.append("") # Empty line between message and comments.
2745 edittext.append("HG: %s" % _("Enter commit message."
2748 edittext.append(hgprefix(_("Enter commit message."
2746 " Lines beginning with 'HG:' are removed."))
2749 " Lines beginning with 'HG:' are removed.")))
2747 edittext.append("HG: %s" % extramsg)
2750 edittext.append(hgprefix(extramsg))
2748 edittext.append("HG: --")
2751 edittext.append("HG: --")
2749 edittext.append("HG: %s" % (_("user: %s") % ctx.user()))
2752 edittext.append(hgprefix(_("user: %s") % ctx.user()))
2750 if ctx.p2():
2753 if ctx.p2():
2751 edittext.append("HG: %s" % _("branch merge"))
2754 edittext.append(hgprefix(_("branch merge")))
2752 if ctx.branch():
2755 if ctx.branch():
2753 edittext.append("HG: %s" % (_("branch '%s'") % ctx.branch()))
2756 edittext.append(hgprefix(_("branch '%s'") % ctx.branch()))
2754 if bookmarks.isactivewdirparent(repo):
2757 if bookmarks.isactivewdirparent(repo):
2755 edittext.append("HG: %s" % (_("bookmark '%s'") % repo._activebookmark))
2758 edittext.append(hgprefix(_("bookmark '%s'") % repo._activebookmark))
2756 edittext.extend(["HG: %s" % (_("subrepo %s") % s) for s in subs])
2759 edittext.extend([hgprefix(_("subrepo %s") % s) for s in subs])
2757 edittext.extend(["HG: %s" % (_("added %s") % f) for f in added])
2760 edittext.extend([hgprefix(_("added %s") % f) for f in added])
2758 edittext.extend(["HG: %s" % (_("changed %s") % f) for f in modified])
2761 edittext.extend([hgprefix(_("changed %s") % f) for f in modified])
2759 edittext.extend(["HG: %s" % (_("removed %s") % f) for f in removed])
2762 edittext.extend([hgprefix(_("removed %s") % f) for f in removed])
2760 if not added and not modified and not removed:
2763 if not added and not modified and not removed:
2761 edittext.append("HG: %s" % _("no files changed"))
2764 edittext.append(hgprefix(_("no files changed")))
2762 edittext.append("")
2765 edittext.append("")
2763
2766
2764 return "\n".join(edittext)
2767 return "\n".join(edittext)
General Comments 0
You need to be logged in to leave comments. Login now