Patchwork [5,of,6] i18n: ignore docstring for modules under mercurial

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Aug. 15, 2017, 4:19 p.m.
Message ID <9278f5eb1e79227c875d.1502813945@speaknoevil>
Download mbox | patch
Permalink /patch/23023/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - Aug. 15, 2017, 4:19 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1502798786 -32400
#      Tue Aug 15 21:06:26 2017 +0900
# Node ID 9278f5eb1e79227c875ddf3a2147b18fc529c504
# Parent  b6dd19c795147e675b9caf58383b6cafd3f03534
# Available At https://bitbucket.org/foozy/mercurial-wip
#              hg pull https://bitbucket.org/foozy/mercurial-wip -r 9278f5eb1e79
# EXP-Topic i18n-fix-update-pot-issues
i18n: ignore docstring for modules under mercurial

Docstring of modules is needed only for "hg help -e EXTNAME".

This is a preparation for applying hggettext on util.py, which has
module docstring, but it isn't needed for translation.

Patch

diff --git a/i18n/hggettext b/i18n/hggettext
--- a/i18n/hggettext
+++ b/i18n/hggettext
@@ -103,7 +103,7 @@  def docstrings(path):
     only extract docstrings from functions mentioned in these tables.
     """
     mod = importpath(path)
-    if mod.__doc__:
+    if not path.startswith('mercurial/') and mod.__doc__:
         src = open(path).read()
         lineno = 1 + offset(src, mod.__doc__, path, 7)
         print(poentry(path, lineno, mod.__doc__))