merge with stable

This should correct an earlier couple of bad merges (5433856b2558 and
596960a4ad0d, now pruned) that accidentally brought in a change that had
been marked obsolete (244ac996a821).
revsetbenchmark: add entry for ::rev::

Revsets of the form ::rev:: were identified as the source behind the
regressions in issue 4201. Ensure we have explicit coverage of that
revset.

--HG--
extra : rebase_source : e1cc26590afcab0d1d9fd0ac1f1869f488708eac
revpair: smartset compatibility

Since recent revset changes, revrange now return a smartset. This smart set
probably does not support indexing (_addset does not). This led to crash.
Instead when the smartset is ordered we use the `min` and `max` method of
smart set. Otherwise we turn is into a list and use indexing on it.

The tests have been updated to catch such regression.

--HG--
extra : rebase_source : f73736cb5f989c30063d47a0f46f44d093481916
revset: raise ValueError when calling min or max on empty smartset

min([]) raise a ValueError, we do the same thing in smartset.min() and
smartset.max() for the sake of consistency.

The min/amax test are greatly improved in the process to prevent this familly
of regression

--HG--
extra : rebase_source : f6fe185a37954b86d57a8d02d88e255b35238b54
bundle2: support unbundling empty part

We augment the unbundler to make it able to unbundle the empty part we are now
able to bundle.

--HG--
extra : rebase_source : b3ac7789d1288b53caa5f16202d07523fa29dcf5
templater: raise error for unknown func

Previously, if a template '{foo()}' was given, the buildfunc would not be able
to match it and hit a code path that would not return so it would error out
later in the templater stating that NoneType was not iterable. This patch makes
sure that a proper error is raised so that the user can be informed.

Tests have been updated.

--HG--
branch : stable
extra : rebase_source : 881859a95f5df9b888ce4b774f3a099e4b675411
hg: introduce "wirepeersetupfuncs" to setup wire peer by extensions (issue4109)

Since changeset 6f72e7d28b35, "reposetup()" of each extensions is
invoked only on repositories enabling corresponded extensions.

This causes that largefiles specific interactions between the
repository enabling largefiles locally and remote (wire) peer fail,
because there is no way to know whether largefiles is enabled on the
remote repository behind the wire peer, and largefiles specific
"wireproto functions" are not given to any wire peers.

To avoid this problem, largefiles should be enabled in wider scope
than each repositories (e.g. user-wide "${HOME}/.hgrc").

This patch introduces "wirepeersetupfuncs" to setup wire peer by
extensions already enabled. Functions registered into
"wirepeersetupfuncs" are invoked for all wire peers.

This patch uses plain list instead of "util.hooks" for
"wirepeersetupfuncs", because the former allows to control order of
function invocation by order of extension enabling: it may be useful
for workaround of problems with combination of enabled extensions

--HG--
branch : stable
extra : rebase_source : bb8b72a285cbf89b1f66ecf9b1a3edff9c1bc4fa
tests: use TESTTMP instead of TESTDIR

In 57d0c8c3b947, f042d4b263f4, 1e686e55780c, and 5d22cadd1938, new tests were
added that used TESTDIR instead of TESTTMP thereby leading to polluting the
working directory with these temporary files. Now, we use TESTTMP so that they
will be cleaned up properly.

--HG--
branch : stable
extra : rebase_source : f321c707a8790bec0d88ed85de3c7ea144d1e2af
i18n-ja: synchronized with e259d4c462b5

--HG--
branch : stable
i18n-pt_BR: synchronized with c57c9cece645

--HG--
branch : stable
merge: fix lack of "%s" in format string causing TypeError at runtime

--HG--
branch : stable
extra : rebase_source : 44df0fef692bcf343d9e748ddb8d7bceb0b657aa
i18n: fix "% inside _()" problems

Before this patch, "contrib/check-code.py" can't detect these
problems, because the regexp pattern to detect "% inside _()" doesn't
suppose the case that the format string and "%" aren't placed in the
same line.

This patch replaces "\s" in that regexp pattern with "[ \t\n]" to
detect "% inside _()" problems in such case.

"[\s\n]" can't be used in this purpose, because "\s" is automatically
replaced with "[ \t]" by "_preparepats()" and "\s" in "[]" causes
nested "[]" unexpectedly.

--HG--
branch : stable
extra : rebase_source : 1a28c327d40f2793356f04c0c54ef34fbcfa4b03
i18n: fix "% inside _()" problems

Before this patch, "contrib/check-code.py" can't detect these
problems, because the regexp pattern to detect "% inside _()" doesn't
suppose the case that format string consists of multiple string
components concatenated implicitly or explicitly,

This patch does below for that regexp pattern to detect "% inside _()"
problems in such case.

  - put "+" into separator part ("[ \t\n]") for explicit concatenation
    ("...." + "...." style)

  - enclose "component and separator" part by "(?:....)+" for
    concatenation itself ("...." "...." or "...." + "....")

--HG--
branch : stable
extra : rebase_source : 710e0f772a95cc7129788fa836cc2d7389f91e1e
merge with stable