histedit: make comment part of the file describing rules as translatable stable
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Mon, 30 Jul 2012 03:27:07 +0900
branchstable
changeset 17315 f320d7ed912f
parent 17314 d5bbb29a80ae
child 17316 8cf995a6dcb0
histedit: make comment part of the file describing rules as translatable "i18n.gettext()" invocation for "editcomment" itself should have little impact for whole initialization cost of histedit, because it is already invoked for initialization of the command table entry. '\n\n' has to be added to the text being edited separately from "editcomment", because leading 'line feed' characters are not exported to "hg.pot" file correctly.
hgext/histedit.py
--- a/hgext/histedit.py	Thu Aug 02 00:52:43 2012 -0500
+++ b/hgext/histedit.py	Mon Jul 30 03:27:07 2012 +0900
@@ -162,9 +162,7 @@
 
 testedwith = 'internal'
 
-editcomment = """
-
-# Edit history between %s and %s
+editcomment = _("""# Edit history between %s and %s
 #
 # Commands:
 #  p, pick = use commit
@@ -173,7 +171,7 @@
 #  d, drop = remove commit from history
 #  m, mess = edit message without changing commit content
 #
-"""
+""")
 
 def between(repo, old, new, keep):
     revs = [old]
@@ -522,6 +520,7 @@
         rules = opts.get('commands', '')
         if not rules:
             rules = '\n'.join([makedesc(c) for c in ctxs])
+            rules += '\n\n'
             rules += editcomment % (node.hex(parent)[:12], node.hex(tip)[:12])
             rules = ui.edit(rules, ui.username())
             # Save edit rules in .hg/histedit-last-edit.txt in case