Commit Graph

544 Commits

Author SHA1 Message Date
Augie Fackler
8facc4e910 hgmanpage: stop using raw-unicode strings
These don't exist in Python 3, and this ends up looking a little more
explicit to Martijn and me anyway.
2016-10-07 07:43:04 -04:00
Yuya Nishihara
e1051c310e doc: remove double imports of inspect from hgmanpage.py 2016-05-14 14:37:25 +09:00
FUJIWARA Katsunori
f46b49a0e3 check-code: detect "missing _() in ui message" more exactly
Before this patch, "missing _() in ui message" rule overlooks
translatable message, which starts with other than alphabet.

To detect "missing _() in ui message" more exactly, this patch
improves the regexp with assumptions below.

  - sequence consisting of below might precede "translatable message"
    in same string token

    - formatting string, which starts with '%'
    - escaped character, which starts with 'b' (as replacement of '\\'), or
    - characters other than '%', 'b' and 'x' (as replacement of alphabet)

  - any string tokens might precede a string token, which contains
    "translatable message"

This patch builds an input file, which is used to examine "missing _()
in ui message" detection, before '"$check_code" stringjoin.py' in
test-contrib-check-code.t, because this reduces amount of change churn
in subsequent patch.

This patch also applies "()" instead of "_()" on messages below to
hide false-positives:

  - messages for ui.debug() or debug commands/tools
    - contrib/debugshell.py
    - hgext/win32mbcs.py (ui.write() is used, though)
    - mercurial/commands.py
      - _debugchangegroup
      - debugindex
      - debuglocks
      - debugrevlog
      - debugrevspec
      - debugtemplate

  - untranslatable messages
    - doc/gendoc.py (ReST specific text)
    - hgext/hgk.py (permission string)
    - hgext/keyword.py (text written into configuration file)
    - mercurial/cmdutil.py (formatting strings for JSON)
2016-06-21 00:50:39 +09:00
timeless
a1cb3173a2 py3: convert to next() function
next(..) was introduced in py2.6 and .next() is not available in py3

https://docs.python.org/2/library/functions.html#next
2016-05-16 21:30:53 +00:00
Matt Mackall
a24591e84c merge with stable 2016-05-17 11:28:46 -05:00
Sean Farley
dc865d7f73 hg-ssh: copy doc string to man page
This corrects a warning from lintian that we're shipping an executable without
a man page. Since there is a doc string in the text, let's use that for the man
page.
2016-05-06 23:03:41 -07:00
Pulkit Goyal
8ceac3e1b6 py3: make doc/docchecker use print_function 2016-05-13 02:41:35 +05:30
Pulkit Goyal
5e47f5d746 py3: make doc/docchecker use absolute_import 2016-05-13 02:40:39 +05:30
Pulkit Goyal
4970ad7eb8 py3: make raise statement python3 compatible
In python3
	raise error, message
has been changed to
	raise error(message)

In additional to that nodes.SkipNode is changed to nodes.SkipNode() so that
it creates an instance directly.
2016-05-13 03:18:04 +05:30
Pulkit Goyal
16d6b10e69 py3: make hgmanpage use absolute_import 2016-04-17 00:23:05 +05:30
Pulkit Goyal
e736fa4f52 py3: make gendoc use absolute_import
Fixed direct imports even the tests were not complaining.
2016-04-17 00:20:44 +05:30
Pulkit Goyal
f869841929 py3: make check-seclevel use absolute_import
Also fixed direct symbol imports even the tests were not complaining.
2016-04-17 00:14:42 +05:30
timeless
6f6caafe41 docchecker: try to reject single quotes 2016-01-12 09:30:57 +00:00
timeless
052bc178fc docchecker: report context line at most once 2016-03-03 03:32:44 +00:00
FUJIWARA Katsunori
8e59a858bd doc: translate from :hg:help config.SECTION to a valid link to hgrc.5.html
Before this patch, ":hg:`help config.SECTION`" in online help text is
translated to a link to "hg.1.html#config.SECTION" in HTML
unintentionally.

This patch translates from :hg:`help config.SECTION` in online help
text to a valid link to "hgrc.5.html#SECTION" in HTML.

This patch ignores element(s) under "SECTION" (e.g. "ITEM" of
":hg:`help config.SECTION.ITEM`"), because there is no way to refer
directly to it in HTML, yet.
2016-02-11 23:15:34 +09:00
FUJIWARA Katsunori
4436dba238 doc: translate from :hg:help config to a valid link to hgrc.5.html
Before this patch, ":hg:`help config`" in online help text is
translated to a link to "hg.1.html#config" in HTML, even though actual
"hg help config" shows not help for "hg config" command but "config"
help topic, and all of current ":hg:`help config`" expects the latter.

This patch translates from ":hg:`help config`" in online help text to
a link to "hgrc.5.html" in HTML as expected.

This patch also allows ":hg:`help -c COMMAND`" style to link
"hg.1.html#COMMAND" for readability.
2016-02-11 23:15:34 +09:00
FUJIWARA Katsunori
357c04e06b docchecker: use indentation of 4 spaces
This is fixing for 'must indent 4 spaces' check-code rule.

check-code has overlooked this, because a file isn't recognized as one
to be checked (this problem is fixed by subsequent patch).
2016-02-10 22:44:29 +09:00
FUJIWARA Katsunori
c26e9ad792 docchecker: remove naked except clause
This is fixing for 'naked except clause' check-code rule.

check-code has overlooked this, because a file isn't recognized as one
to be checked (this problem is fixed by subsequent patch).
2016-02-10 22:44:29 +09:00
Bryan O'Sullivan
425505f93a check-seclevel: use a context manager for file I/O 2016-01-12 14:28:16 -08:00
timeless
81962ef57d docchecker: scan for missing space before :hg: 2016-01-06 20:05:18 +00:00
timeless
70bec9473a docchecker: introduce a way to check for poor markup
Specifically, :hg:`foo 'bar baz'` when rendered by `hg help`
results in:

  'hg foo 'bar baz''

... which is hard to read.

We encourage :hg:`foo "bar baz"` instead.
2016-01-06 19:47:14 +00:00
Jun Wu
ea41b32b83 mercurial: pass ui to extensions.load (issue5007)
extensions.load does need ui argument to print error if an extension
fails to load.
2015-12-17 10:30:17 +00:00
Bryan O'Sullivan
d7b0a811b8 check-seclevel: pass a ui to the extension loader
Without this, if an import error occurs (as with pypy), the attempt to
report it fails since ui is None.
2015-12-22 21:38:06 -08:00
Bryan O'Sullivan
b75f25ac1e check-seclevel: add a --debug option
This will make it possible to get semi-meaningful tracebacks if an import
error occurs.

Why care? Trying to run this script under pypy currently fails, but the
true error is obscured.
2015-12-22 21:38:05 -08:00
timeless
b7fa6a1a27 doc: add execute bit and fix shbang line for gendoc.py 2015-12-22 07:59:14 +00:00
Gregory Szorc
b6d0b58fa7 doc: make gendoc.py module import policy aware
Without this, running gendoc.py during an install without C modules
available (via `make local`) will result in an import failure because
the default module load policy insists on C modules.

We also remove the sys.path adjustment because it is no longer needed
since our magic importer handles things.
2015-12-12 13:23:29 -05:00
Gregory Szorc
ec18b44ca2 check-seclevel: set module load policy to Python only
If we don't change this, the upcoming change to make the module
loading policy only load C modules will cause this script to fail if
run with CPython against an unbuilt source checkout.
2015-11-24 22:53:55 -08:00
Mads Kiilerich
09567db49a spelling: trivial spell checking 2015-10-17 00:58:46 +02:00
Matt Mackall
5e1b4ad958 urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
Yuya Nishihara
2f746aa9d3 help: pass around ui to doc loader (API)
This is necessary to hide DEPRECATED items conditionally.

Flagged as API change because it will break "hg help git|subversion".
2015-09-26 12:06:30 +09:00
Yuya Nishihara
958a6389af gendoc: use real ui in place of stdout
ui attributes will be required by a help function, so a file object can't be
used as a fake ui.
2015-09-27 23:34:37 +09:00
Yuya Nishihara
f3df68f405 check-seclevel: use ui to show status and error messages
Future patches will require ui module to be passed to a help function, so
let's use it where appropriate.

Additional parens are necessary to silence a check-code warning.
2015-09-27 22:29:07 +09:00
Yuya Nishihara
4b52e9276e check-seclevel: wrap entry point by function
This is intended to narrow scope of local variables. The global _verbose
flag will be replaced later by ui.verbose.
2015-09-27 22:19:54 +09:00
Yuya Nishihara
a63986f458 check-seclevel: set executable bit as it has shebang 2015-09-27 22:16:24 +09:00
timeless@mozdev.org
96eb7ea38c hgmanpage: fix grammar
remove 's's from places where they don't belong
insert the preposition 'in'
2015-09-08 13:22:01 -04:00
timeless@mozdev.org
52f5c5239d check-seclevel: fix file description grammar 2015-09-08 12:54:39 -04:00
Mads Kiilerich
b2b60414f6 spelling: fixes from proofreading of spell checker issues 2015-01-18 02:38:57 +01:00
Augie Fackler
9f565e54cb gendoc: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:23:57 -04:00
Augie Fackler
4b15479b96 check-seclevel: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:23:47 -04:00
FUJIWARA Katsunori
138416bff7 doc: show short description of each commands in generated documents
Before this patch, short description of each commands is not shown in
generated documents (HTML file and UNIX man page). This omitting may
prevent users from understanding about commands.

This patch show it as the 1st paragraph in the help section of each
commands. This style is chosen because:

  - showing it as the section title in "command - short desc" style
    disallows referencing by "#command" in HTML file: in "en" locale,
    hyphen concatenated title is used as the section ID in HTML file
    for this style

  - showing it as the 1st paragraph in "command - short desc" style
    seems to be redundant: "command" appears also just before as the
    section title

  - showing it just after synopsis like "hg help command" seems not to
    be reasonable in UNIX man page

This patch just writes short description ("d['desc'][0]") before "::",
because it should be already "strip()"-ed in "get_desc()", or empty
string for the command without description.
2014-03-11 14:36:40 +09:00
Simon Heimberg
ff9aaaba6b doc: gendoc.py creates valid output for option descriptions with newlines
gendoc.py did not handle the hanging indentation for descriptions. Work around
this by joining all in one single line (same as in minirst since previous
patch).

This problem occurred when translations of option lines were very long. Do not
bother the translators with this detail.

On a long option description, the translator continued on a new line as usual.
gendoc.py created invalid rst syntax like this:

-o, --option
    Description line 1
description line 2

The new output is:

-o, --option
    Description line 1 description line 2

The lines could theoretically become very long, but line breaking is handled
when generating the final documentation.
2014-02-20 09:17:22 +01:00
FUJIWARA Katsunori
8c1c74a873 doc: show details of command options in pages generated by docutils
Before this patch, HTML/man pages generated by docutils don't show
details of each command options, whether it should take argument or
not for example, even though "hg help" does.

This patch shows details of command options as same as "hg help"
shows.

This patch uses "--option <VALUE[+]>" style instead of "--option
<VALUE> [+]" used in output of "hg help", because docutils requires
that option argument strings starts with "<" and ends with ">".
2013-11-08 14:42:09 +09:00
Takumi IINO
c57d1116da doc: make i18n man and html
Allow overwrite LANGUAGE and LC_ALL make variables, for make i18n man and html.
After this patch, we can make i18n man and html by following command:

  $ make clean all LANGUAGE=ja
2013-07-03 21:50:20 +09:00
Takumi IINO
2d38f7b9dd doc: make man and html from translated documents
Before this patch, man and html are english only, and there sources are not
translatable.
This patch make translatable all documents.
2013-07-03 21:49:43 +09:00
Takumi IINO
4e9e5e1a97 gendoc: dispatch print document content by commandline arguments
Before this patch, gendoc.py only prints hg.1.gendoc.txt content.
This adds any content print function.
2013-07-03 21:49:41 +09:00
Takumi IINO
aa35bddf6e gendoc: add showtopic
This function prints any topic.
2013-07-03 21:49:39 +09:00
Takumi IINO
6a0123c5c5 gendoc: rename to showdoc from show_doc
This function prints hg.1.gendoc.txt content.
2013-07-03 21:49:37 +09:00
Simon Heimberg
6059e06d0f cleanup: drop unused variables and an unused import 2013-07-01 20:48:56 +02:00
Matt Mackall
db1209d4bd merge with stable 2013-06-21 15:31:40 -05:00
Matt Mackall
ea11ead369 docs: change description to synopsis in hgrc.5
Spotted by Eric S. Raymond.
2013-06-20 14:06:11 -05:00