Last active
December 17, 2015 00:00
-
-
Save troter/5518030 to your computer and use it in GitHub Desktop.
[WIP]mercurail i18n doc generate patch: make clean all LC_ALL=ja_JP.UTF-8 LANGUAGE=ja
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HG changeset patch | |
# User Takumi IINO <[email protected]> | |
# Date 1367677871 -32400 | |
# Sat May 04 23:31:11 2013 +0900 | |
# Branch stable | |
# Node ID 460c0546e96ba7dd670876ff76757286dd67219c | |
# Parent a6542a670ece8e13ae7b32ef28e2816d63120524 | |
doc: move to i18n translation source directory | |
diff --git a/.hgignore b/.hgignore | |
--- a/.hgignore | |
+++ b/.hgignore | |
@@ -25,7 +25,9 @@ | |
build | |
contrib/hgsh/hgsh | |
dist | |
+doc/common.txt | |
doc/*.[0-9] | |
+doc/*.[0-9].txt | |
doc/*.[0-9].gendoc.txt | |
doc/*.[0-9].{x,ht}ml | |
MANIFEST | |
diff --git a/doc/Makefile b/doc/Makefile | |
--- a/doc/Makefile | |
+++ b/doc/Makefile | |
@@ -1,4 +1,4 @@ | |
-SOURCES=$(wildcard *.[0-9].txt) | |
+SOURCES=$(notdir $(wildcard ../mercurial/help/*.[0-9].txt)) | |
MAN=$(SOURCES:%.txt=%) | |
HTML=$(SOURCES:%.txt=%.html) | |
GENDOC=gendoc.py ../mercurial/commands.py ../mercurial/help.py \ | |
@@ -18,17 +18,30 @@ | |
html: $(HTML) | |
-hg.1.txt: hg.1.gendoc.txt | |
+common.txt: ../mercurial/help/common.txt | |
+ cp ../mercurial/help/common.txt . | |
+ touch common.txt | |
+ | |
+hg.1.txt: ../mercurial/help/hg.1.txt hg.1.gendoc.txt | |
+ cp ../mercurial/help/hg.1.txt . | |
touch hg.1.txt | |
hg.1.gendoc.txt: $(GENDOC) | |
${PYTHON} gendoc.py > [email protected] | |
mv [email protected] $@ | |
+hgrc.5.txt: ../mercurial/help/hgrc.5.txt | |
+ cp ../mercurial/help/hgrc.5.txt . | |
+ touch hgrc.5.txt | |
+ | |
hgrc.5: ../mercurial/help/config.txt | |
hgrc.5.html: ../mercurial/help/config.txt | |
+hgignore.5.txt: ../mercurial/help/hgignore.5.txt | |
+ cp ../mercurial/help/hgignore.5.txt . | |
+ touch hgignore.5.txt | |
+ | |
%: %.txt common.txt | |
$(PYTHON) runrst hgmanpage $(RSTARGS) --halt warning \ | |
--strip-elements-with-class htmlonly $*.txt $* | |
@@ -52,4 +65,4 @@ | |
done | |
clean: | |
- $(RM) $(MAN) $(HTML) hg.1.gendoc.txt MANIFEST | |
+ $(RM) $(MAN) $(HTML) common.txt hg.1.txt hgrc.5.txt hgignore.5.txt hg.1.gendoc.txt MANIFEST | |
diff --git a/doc/common.txt b/mercurial/help/common.txt | |
rename from doc/common.txt | |
rename to mercurial/help/common.txt | |
diff --git a/doc/hg.1.txt b/mercurial/help/hg.1.txt | |
rename from doc/hg.1.txt | |
rename to mercurial/help/hg.1.txt | |
diff --git a/doc/hgignore.5.txt b/mercurial/help/hgignore.5.txt | |
rename from doc/hgignore.5.txt | |
rename to mercurial/help/hgignore.5.txt | |
diff --git a/doc/hgrc.5.txt b/mercurial/help/hgrc.5.txt | |
rename from doc/hgrc.5.txt | |
rename to mercurial/help/hgrc.5.txt | |
# HG changeset patch | |
# User Takumi IINO <[email protected]> | |
# Date 1367685440 -32400 | |
# Sun May 05 01:37:20 2013 +0900 | |
# Branch stable | |
# Node ID 188cb5b278c331c64bfc72892f9c282871e7c5f4 | |
# Parent 460c0546e96ba7dd670876ff76757286dd67219c | |
doc: get i18n message | |
diff --git a/doc/gendoc.py b/doc/gendoc.py | |
--- a/doc/gendoc.py | |
+++ b/doc/gendoc.py | |
@@ -51,7 +51,7 @@ | |
d['cmd'] = cmds[0] | |
d['aliases'] = cmd.split("|")[1:] | |
- d['desc'] = get_desc(attr[0].__doc__) | |
+ d['desc'] = get_desc(_(attr[0].__doc__)) | |
d['opts'] = list(get_opts(attr[1])) | |
s = 'hg ' + cmds[0] | |
@@ -102,7 +102,7 @@ | |
for extensionname in sorted(allextensionnames()): | |
mod = extensions.load(None, extensionname, None) | |
ui.write(minirst.subsection(extensionname)) | |
- ui.write("%s\n\n" % mod.__doc__) | |
+ ui.write("%s\n\n" % _(mod.__doc__)) | |
cmdtable = getattr(mod, 'cmdtable', None) | |
if cmdtable: | |
ui.write(minirst.subsubsection(_('Commands'))) | |
# HG changeset patch | |
# User Takumi IINO <[email protected]> | |
# Date 1367685448 -32400 | |
# Sun May 05 01:37:28 2013 +0900 | |
# Branch stable | |
# Node ID 69ce8b6ff72cb6f2cd0d120e5594a34d611778d7 | |
# Parent 188cb5b278c331c64bfc72892f9c282871e7c5f4 | |
gendoc: rename show_doc_hg | |
diff --git a/doc/gendoc.py b/doc/gendoc.py | |
--- a/doc/gendoc.py | |
+++ b/doc/gendoc.py | |
@@ -64,7 +64,7 @@ | |
return d | |
-def show_doc(ui): | |
+def show_doc_hg(ui): | |
# print options | |
ui.write(minirst.section(_("Options"))) | |
for optstr, desc in get_opts(globalopts): | |
@@ -153,4 +153,4 @@ | |
return extensions.enabled().keys() + extensions.disabled().keys() | |
if __name__ == "__main__": | |
- show_doc(sys.stdout) | |
+ show_doc_hg(sys.stdout) | |
# HG changeset patch | |
# User Takumi IINO <[email protected]> | |
# Date 1367685450 -32400 | |
# Sun May 05 01:37:30 2013 +0900 | |
# Branch stable | |
# Node ID 4f8b1f6847689c9d9a8346fffb8c671257bed88f | |
# Parent 69ce8b6ff72cb6f2cd0d120e5594a34d611778d7 | |
gendoc: usage, parse argument | |
diff --git a/doc/Makefile b/doc/Makefile | |
--- a/doc/Makefile | |
+++ b/doc/Makefile | |
@@ -27,7 +27,7 @@ | |
touch hg.1.txt | |
hg.1.gendoc.txt: $(GENDOC) | |
- ${PYTHON} gendoc.py > [email protected] | |
+ ${PYTHON} gendoc.py hg.1.gendoc > [email protected] | |
mv [email protected] $@ | |
hgrc.5.txt: ../mercurial/help/hgrc.5.txt | |
diff --git a/doc/gendoc.py b/doc/gendoc.py | |
--- a/doc/gendoc.py | |
+++ b/doc/gendoc.py | |
@@ -1,3 +1,8 @@ | |
+"""usage: %s DOC ... | |
+ | |
+where DOC is the name of a docment | |
+""" | |
+ | |
import os, sys, textwrap | |
# import from the live mercurial repo | |
sys.path.insert(0, "..") | |
@@ -153,4 +158,10 @@ | |
return extensions.enabled().keys() + extensions.disabled().keys() | |
if __name__ == "__main__": | |
- show_doc_hg(sys.stdout) | |
+ if len(sys.argv) < 2: | |
+ sys.stderr.write(__doc__ % sys.argv[0]) | |
+ sys.exit(1) | |
+ | |
+ doc = sys.argv[1] | |
+ if doc == 'hg.1.gendoc': | |
+ show_doc_hg(sys.stdout) | |
# HG changeset patch | |
# User Takumi IINO <[email protected]> | |
# Date 1367685451 -32400 | |
# Sun May 05 01:37:31 2013 +0900 | |
# Branch stable | |
# Node ID 88600f9a7753e78a7fcce14fbc8450f2c567500a | |
# Parent 4f8b1f6847689c9d9a8346fffb8c671257bed88f | |
doc show topic | |
diff --git a/doc/Makefile b/doc/Makefile | |
--- a/doc/Makefile | |
+++ b/doc/Makefile | |
@@ -19,28 +19,28 @@ | |
html: $(HTML) | |
common.txt: ../mercurial/help/common.txt | |
- cp ../mercurial/help/common.txt . | |
- touch common.txt | |
+ ${PYTHON} gendoc.py common > [email protected] | |
+ mv [email protected] $@ | |
hg.1.txt: ../mercurial/help/hg.1.txt hg.1.gendoc.txt | |
- cp ../mercurial/help/hg.1.txt . | |
- touch hg.1.txt | |
+ ${PYTHON} gendoc.py hg.1 > [email protected] | |
+ mv [email protected] $@ | |
hg.1.gendoc.txt: $(GENDOC) | |
${PYTHON} gendoc.py hg.1.gendoc > [email protected] | |
mv [email protected] $@ | |
hgrc.5.txt: ../mercurial/help/hgrc.5.txt | |
- cp ../mercurial/help/hgrc.5.txt . | |
- touch hgrc.5.txt | |
+ ${PYTHON} gendoc.py hgrc.5 > [email protected] | |
+ mv [email protected] $@ | |
hgrc.5: ../mercurial/help/config.txt | |
hgrc.5.html: ../mercurial/help/config.txt | |
hgignore.5.txt: ../mercurial/help/hgignore.5.txt | |
- cp ../mercurial/help/hgignore.5.txt . | |
- touch hgignore.5.txt | |
+ ${PYTHON} gendoc.py hgignore.5 > [email protected] | |
+ mv [email protected] $@ | |
%: %.txt common.txt | |
$(PYTHON) runrst hgmanpage $(RSTARGS) --halt warning \ | |
diff --git a/doc/gendoc.py b/doc/gendoc.py | |
--- a/doc/gendoc.py | |
+++ b/doc/gendoc.py | |
@@ -13,7 +13,7 @@ | |
from mercurial import minirst | |
from mercurial.commands import table, globalopts | |
from mercurial.i18n import _ | |
-from mercurial.help import helptable | |
+from mercurial.help import helptable, loaddoc | |
from mercurial import extensions | |
from mercurial import util | |
@@ -154,6 +154,10 @@ | |
ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases'])) | |
+def show_topic(ui, topic): | |
+ ui.write(loaddoc(topic)()) | |
+ | |
+ | |
def allextensionnames(): | |
return extensions.enabled().keys() + extensions.disabled().keys() | |
@@ -165,3 +169,5 @@ | |
doc = sys.argv[1] | |
if doc == 'hg.1.gendoc': | |
show_doc_hg(sys.stdout) | |
+ elif doc in ('common', 'hg.1', 'hgrc.5', 'hgignore.5'): | |
+ show_topic(sys.stdout, sys.argv[1]) | |
# HG changeset patch | |
# User Takumi IINO <[email protected]> | |
# Date 1367685453 -32400 | |
# Sun May 05 01:37:33 2013 +0900 | |
# Branch stable | |
# Node ID 206bac752f23fc0b3e697ffebd353336f0e6fcfb | |
# Parent 88600f9a7753e78a7fcce14fbc8450f2c567500a | |
gendoc: gendocs | |
diff --git a/doc/Makefile b/doc/Makefile | |
--- a/doc/Makefile | |
+++ b/doc/Makefile | |
@@ -30,18 +30,26 @@ | |
${PYTHON} gendoc.py hg.1.gendoc > [email protected] | |
mv [email protected] $@ | |
-hgrc.5.txt: ../mercurial/help/hgrc.5.txt | |
+hgrc.5.txt: ../mercurial/help/hgrc.5.txt hgrc.5.gendoc.txt | |
${PYTHON} gendoc.py hgrc.5 > [email protected] | |
mv [email protected] $@ | |
+hgrc.5.gendoc.txt: $(GENDOC) | |
+ ${PYTHON} gendoc.py hgrc.5.gendoc > [email protected] | |
+ mv [email protected] $@ | |
+ | |
hgrc.5: ../mercurial/help/config.txt | |
hgrc.5.html: ../mercurial/help/config.txt | |
-hgignore.5.txt: ../mercurial/help/hgignore.5.txt | |
+hgignore.5.txt: ../mercurial/help/hgignore.5.txt hgignore.5.gendoc.txt | |
${PYTHON} gendoc.py hgignore.5 > [email protected] | |
mv [email protected] $@ | |
+hgignore.5.gendoc.txt: $(GENDOC) | |
+ ${PYTHON} gendoc.py hgignore.5.gendoc > [email protected] | |
+ mv [email protected] $@ | |
+ | |
%: %.txt common.txt | |
$(PYTHON) runrst hgmanpage $(RSTARGS) --halt warning \ | |
--strip-elements-with-class htmlonly $*.txt $* | |
@@ -65,4 +73,7 @@ | |
done | |
clean: | |
- $(RM) $(MAN) $(HTML) common.txt hg.1.txt hgrc.5.txt hgignore.5.txt hg.1.gendoc.txt MANIFEST | |
+ $(RM) $(MAN) $(HTML) \ | |
+ common.txt hg.1.txt hgrc.5.txt hgignore.5.txt \ | |
+ hg.1.gendoc.txt hgrc.5.gendoc.txt hgignore.5.gendoc.txt \ | |
+ MANIFEST | |
diff --git a/doc/gendoc.py b/doc/gendoc.py | |
--- a/doc/gendoc.py | |
+++ b/doc/gendoc.py | |
@@ -154,6 +154,38 @@ | |
ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases'])) | |
+def show_doc_hgrc(ui): | |
+ # print config | |
+ for names, sec, doc in helptable: | |
+ if names[0] != "config": | |
+ # Other than config help topics isn't included in the | |
+ # hgrc.5 man page | |
+ continue | |
+ for name in names: | |
+ ui.write(".. _%s:\n" % name) | |
+ ui.write("\n") | |
+ if util.safehasattr(doc, '__call__'): | |
+ doc = doc() | |
+ ui.write(doc) | |
+ ui.write("\n") | |
+ | |
+ | |
+def show_doc_hgignore(ui): | |
+ # print hgignore | |
+ for names, sec, doc in helptable: | |
+ if names[0] != "hgignore": | |
+ # Other than hgignore help topics isn't included in the | |
+ # hgignore.5 man page | |
+ continue | |
+ for name in names: | |
+ ui.write(".. _%s:\n" % name) | |
+ ui.write("\n") | |
+ if util.safehasattr(doc, '__call__'): | |
+ doc = doc() | |
+ ui.write(doc) | |
+ ui.write("\n") | |
+ | |
+ | |
def show_topic(ui, topic): | |
ui.write(loaddoc(topic)()) | |
@@ -169,5 +201,9 @@ | |
doc = sys.argv[1] | |
if doc == 'hg.1.gendoc': | |
show_doc_hg(sys.stdout) | |
+ elif doc == 'hgrc.5.gendoc': | |
+ show_doc_hgrc(sys.stdout) | |
+ elif doc == 'hgignore.5.gendoc': | |
+ show_doc_hgignore(sys.stdout) | |
elif doc in ('common', 'hg.1', 'hgrc.5', 'hgignore.5'): | |
show_topic(sys.stdout, sys.argv[1]) | |
# HG changeset patch | |
# User Takumi IINO <[email protected]> | |
# Date 1367685455 -32400 | |
# Sun May 05 01:37:35 2013 +0900 | |
# Branch stable | |
# Node ID f100d8f5cc260731626797038bbf195872275a35 | |
# Parent 206bac752f23fc0b3e697ffebd353336f0e6fcfb | |
doc: use gendoc | |
diff --git a/mercurial/help/hgignore.5.txt b/mercurial/help/hgignore.5.txt | |
--- a/mercurial/help/hgignore.5.txt | |
+++ b/mercurial/help/hgignore.5.txt | |
@@ -11,7 +11,7 @@ | |
:Manual section: 5 | |
:Manual group: Mercurial Manual | |
-.. include:: ../mercurial/help/hgignore.txt | |
+.. include:: hgignore.5.gendoc.txt | |
Author | |
====== | |
diff --git a/mercurial/help/hgrc.5.txt b/mercurial/help/hgrc.5.txt | |
--- a/mercurial/help/hgrc.5.txt | |
+++ b/mercurial/help/hgrc.5.txt | |
@@ -19,7 +19,7 @@ | |
Synopsis | |
======== | |
-.. include:: ../mercurial/help/config.txt | |
+.. include:: hgrc.5.gendoc.txt | |
Author | |
====== | |
# HG changeset patch | |
# User Takumi IINO <[email protected]> | |
# Date 1367685459 -32400 | |
# Sun May 05 01:37:39 2013 +0900 | |
# Branch stable | |
# Node ID 83f3e767136087eb18f19239849e302e61532474 | |
# Parent f100d8f5cc260731626797038bbf195872275a35 | |
doc: dont export LANUGAGE and LC_ALL | |
diff --git a/doc/Makefile b/doc/Makefile | |
--- a/doc/Makefile | |
+++ b/doc/Makefile | |
@@ -9,8 +9,8 @@ | |
PYTHON=python | |
RSTARGS= | |
-export LANGUAGE=C | |
-export LC_ALL=C | |
+LANGUAGE=C | |
+LC_ALL=C | |
all: man html | |
# HG changeset patch | |
# User Takumi IINO <[email protected]> | |
# Date 1367685463 -32400 | |
# Sun May 05 01:37:43 2013 +0900 | |
# Branch stable | |
# Node ID ba763d758e1ebb4f37f5587ec02aa1339289567d | |
# Parent 83f3e767136087eb18f19239849e302e61532474 | |
i18n-ja: dirty rst syntax fix | |
diff --git a/i18n/ja.po b/i18n/ja.po | |
--- a/i18n/ja.po | |
+++ b/i18n/ja.po | |
@@ -9071,7 +9071,7 @@ | |
msgstr " - REV までの全リビジョンを、現リビジョン上に移植::" | |
msgid " hg transplant --branch REV --all" | |
-msgstr " hg transplant --branch REV --all" | |
+msgstr " hg transplant --branch REV --all" | |
msgid "" | |
" You can optionally mark selected transplanted changesets as merge\n" | |
@@ -10210,7 +10210,7 @@ | |
" backout cannot be used to fix either an unwanted or\n" | |
" incorrect merge." | |
msgstr "" | |
-" .. note::\n" | |
+" .. note::\n\n" | |
" :hg:`backout` による打消し機能は、マージ実施リビジョンに対しては、\n" | |
" 適用できません。" | |
@@ -13471,14 +13471,14 @@ | |
" -Af R R R R\n" | |
" ======= == == == ==" | |
msgstr "" | |
-" ======= == == == ==\n" | |
-" A C M !\n" | |
-" ======= == == == ==\n" | |
-" 無指定 W RD W R\n" | |
-" -f R RD RD R\n" | |
-" -A W W W R\n" | |
-" -Af R R R R\n" | |
-" ======= == == == ==" | |
+" ======= == == == ==\n" | |
+" A C M !\n" | |
+" ======= == == == ==\n" | |
+" 無指定 W RD W R\n" | |
+" -f R RD RD R\n" | |
+" -A W W W R\n" | |
+" -Af R R R R\n" | |
+" ======= == == == ==" | |
msgid "" | |
" Note that remove never deletes files in Added [A] state from the\n" | |
@@ -18434,9 +18434,9 @@ | |
" version of the ssl library that is available from\n" | |
" ``http://pypi.python.org``." | |
msgstr "" | |
-" 本機能は Python 2.6 以降で利用可能です。 それ以前の Python において、\n" | |
-" 本機能を利用する場合は、 ``http://pypi.python.org`` から入手できる\n" | |
-" SSL ライブラリの後方移植版をインストールしてください。" | |
+" 本機能は Python 2.6 以降で利用可能です。 それ以前の Python において、\n" | |
+" 本機能を利用する場合は、 ``http://pypi.python.org`` から入手できる\n" | |
+" SSL ライブラリの後方移植版をインストールしてください。" | |
msgid "" | |
" To disable SSL verification temporarily, specify ``--insecure`` from\n" | |
# HG changeset patch | |
# User Takumi IINO <[email protected]> | |
# Date 1367685550 -32400 | |
# Sun May 05 01:39:10 2013 +0900 | |
# Branch stable | |
# Node ID db37d9a8a9de5553fca51144713f609ebeae8d5b | |
# Parent ba763d758e1ebb4f37f5587ec02aa1339289567d | |
[from now] 2013-05-05 01:39:10 | |
diff --git a/mercurial/help/hg.1.txt b/mercurial/help/hg.1.txt | |
--- a/mercurial/help/hg.1.txt | |
+++ b/mercurial/help/hg.1.txt | |
@@ -31,7 +31,6 @@ | |
files... | |
indicates one or more filename or relative path filenames; see | |
- `File Name Patterns`_ for information on pattern matching | |
path | |
indicates a path on the local machine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment