FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Tue, 15 Aug 2017 19:27:24 +0900] rev 33818
i18n: use saved object to get actual function information if available
To list up available compression types instead of
".. bundlecompressionmarker" in "hg help bundlespec" output, proxy
object "docobject" is used, because:
- current online help system requires that __doc__ of registered
object (maybe, function) is already well formatted in reST syntax
- bundletype() method of compressionengine classes is used to list up
available compression types, but
- __doc__ of bundletype() object (= "instancemethod") is read-only
On the other hand, hggettext requires original function object, in
order to get document location in source code.
Therefore, description of each compression types isn't yet
translatable. Even if translatable, translators should make much
effort to determine location of original texts in source code.
To get actual function information, this patch makes hggettext use
function object saved as "_origfunc", if it is available. This patch
also changes bundlecompressiontopics() side, in order to explain how
these changes work easily.
This patch is a part of preparations for making description of each
compression types translatable.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Sun, 13 Aug 2017 15:20:16 +0900] rev 33817
i18n: ignore doctest part to avoid warning at "make update-pot"
hggettext assumes that backslashes in docstring are always doubled in
original source code, in order to find the location of original
docstring out certainly.
This assumption almost always works as expected. But doctest easily
breaks it, because many of backslashes in doctests aren't doubled.
This mismatching causes "unknown offset in ..." warning at "make
update-pot".
To avoid such warning, this patch ignores doctest part of docstring
before finding the location of original docstring out.
BTW, at this patch, only person() in templatefilters.py has doctest
part, which causes "unknown offset ..." warning.
Therefore, just making backslashes in that doctest doubled can avoid
such warning, too. But forcing doctest writers to double backslashes
in doctest isn't reasonable, IMHO.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Wed, 02 Aug 2017 01:15:07 +0900] rev 33816
largefiles: fix help text to avoid warning at "make update-pot"
This change helps hggettext to find out help text in original source,
because it assumes that backslash ('\') is doubled in docstring.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Wed, 02 Aug 2017 01:03:20 +0900] rev 33815
i18n: make hggettext use original docstring to compute offset
Before this patch, hggettext uses __doc__ of each functions to compute
offset of document text.
But __doc__ of many functions is already modified by decorators in
registrar (e.g. @templatekeyword adds ":NAME: " prefix to it), and
hggettext can not find it out in original source.
This causes many "unknown offset in ..." warning at "make update-pot",
and leaving them might cause overlooking serious problems.
This patch makes hggettext use original docstring, which decorators in
registrar save into _origdoc, to compute offset.
Even after this patch, there are still a few "unknown offset in ..."
warning at "make update-pot" for specific reasons. These will be fixed
later one by one.
Matthieu Laneuville <matthieu.laneuville@octobus.net> [Fri, 11 Aug 2017 14:21:49 +0200] rev 33814
run-tests: also color the summary messages (skipped, failed...)
Filip Filmar <filmil@gmail.com> [Sun, 13 Aug 2017 00:17:13 -0700] rev 33813
crecord: fixes the formatting of the select status in the status line
The status line in the crecord has the "space" status field which has variable
length depending on the length of the status label in the language of choice.
In English, the status labels are "space: deselect" and "space:select". The
"deselect" label is 2 glyphs longer. This makes the terminal output jump
around if the terminal width is just right so that the shorter label makes
the status line 1 line long, and the longer label makes it 2 lines long.
This patch formats the selected status into a fixed-width field. The field
width is the maximum of the lengths of the two possible labels, to account for
differing translations and label lengths. This should make the label behavior
uniform across localizations.
There does not seem to be a test for crecord, so I verified the change manually
with a local build of 'hg'.
Yuya Nishihara <yuya@tcha.org> [Mon, 14 Aug 2017 13:35:26 +0900] rev 33812
cext: move PyInt macros to charencode.c properly
Python3 build was broken at
e9996bd7203f.
Yuya Nishihara <yuya@tcha.org> [Mon, 14 Aug 2017 15:50:40 +0900] rev 33811
py3: change encoding.localstr to a subclass of bytes, not str
Yuya Nishihara <yuya@tcha.org> [Sun, 13 Aug 2017 11:10:35 +0900] rev 33810
bundle2: relax the condition to update transaction.hookargs
This is just a micro optimization. If hookargs is empty, nothing should be
necessary.
Yuya Nishihara <yuya@tcha.org> [Sun, 13 Aug 2017 11:05:56 +0900] rev 33809
bundle2: raise ProgrammingError for invalid call of addhookargs()
It should be hard error. Also fixed the error message as s/hooks/hookargs/.
Alex Gaynor <agaynor@mozilla.com> [Fri, 14 Jul 2017 19:27:28 +0000] rev 33808
merge: removed sorting in casefolding detection, for a slight performance win
It was not required for the correctness of the algorithm.
Differential Revision: https://phab.mercurial-scm.org/D30
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 10 Aug 2017 21:00:30 -0700] rev 33807
tests: verify that peer instances only expose interface members
Our abstract interfaces are more useful if we guarantee that
implementations conform to certain rules. Namely, we want to ensure
that objects implementing interfaces don't expose new public
attributes that aren't part of the interface. That way, as long as
consumers don't access "internal" attributes (those beginning with
"_") then (in theory) objects implementing interfaces can be swapped
out and everything will "just work."
We add a test that enforces our "no public attributes not part
of the abstract interface" rule.
We /could/ implement "interface compliance detection" at run-time.
However, that is littered with problems.
The obvious solutions are custom __new__ and __init__ methods.
These rely on derived types actually calling the parent's
implementation, which is no sure bet. Furthermore, __new__ and
__init__ will likely be called before instance-specific attributes
are assigned. In other words, they won't detect public attributes
set on self.__dict__. This means public attribute detection won't
be robust.
We could work around lack of robust self.__dict__ public attribute
detection by having our interfaces implement a custom __getattribute__,
__getattr__, and/or __setattr__. However, this incurs an undesirable
run-time penalty. And, subclasses could override our custom
method, bypassing the check.
The most robust solution is a non-runtime test. So that's what this
commit implements. We have a generic function for validating that an
object only has public attributes defined by abstract classes. Then,
we instantiate some peers and verify a newly constructed object
plays by the rules.
Differential Revision: https://phab.mercurial-scm.org/D339