Commit Graph

1695 Commits

Author SHA1 Message Date
Yuya Nishihara
5bae87a105 chg: silence warning of unused parameter 'sig' 2016-06-28 22:39:06 +09:00
Pulkit Goyal
c74034c936 py3: add tests in check-code to load modules from util.py
The conditionalize imports are added in util.py and now we import modules from
there. So adding tests so that someone in future can use that.
2016-06-27 19:10:30 +05:30
Jun Wu
dfebfdbf56 chg: send SIGPIPE to server immediately when pager exits (issue5278)
If the user press 'q' to leave the 'less' pager, it is expected to end the
hg process immediately. We currently rely on SIGPIPE for this behavior. But
SIGPIPE won't arrive if we don't write anything (like doing heavy
computation, reading from network etc). If that happens, the user will feel
that the hg process just hangs.

The patch address the issue by adding a SIGCHLD signal handler and sends
SIGPIPE to the server as soon as the pager exits.

This is also an issue with hg's pager implementation.
2016-06-24 15:21:10 +01:00
FUJIWARA Katsunori
8329fc9bdf check-code: build translation table for repquote in global for efficiency
Rebuilding translation table (256 size) at each repquote() invocations
is redundant.

For example, this patch decreases user time of command invocation
below from 18.297s to 13.445s (about -27%) on a Linux box. This
command is main part of test-check-code.t.

    hg locate | xargs python contrib/check-code.py --warnings --per-file=0

This patch adds "_repquote" prefix to functions and variables factored
out from repquote() to avoid conflict of name in the future.
2016-06-21 00:50:39 +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
Augie Fackler
cfab112ddc import-checker: ensure cffi is always a system module
I've had reports that this is not always happening, so whitelist it
the way we whitelist other problem cases.
2016-06-23 20:45:37 -04:00
Martijn Pieters
1df88133b7 bashcompletion: show available command-line switches for aliases
When auto-completing hg commands, aliases are listed, but not the available
switches for an alias, because `HGPLAIN=1` filters these out. Add a
`HGPLAINEXCEPT=alias` exception to resolve this.

We make heavy use of aliases that drive hg log with custom revsets, sorting and
the -G switch, but want our users to be able to auto-complete any additional
command-line switches.
2016-06-21 17:15:51 +01:00
Pulkit Goyal
04a26c4980 py3: shift from __future__ import absolute import to beginning (issue5269) 2016-06-20 23:31:45 +05:30
FUJIWARA Katsunori
f32b1f4b1c import-checker: increase portability for python 2.6.x
Before this patch, fromlocalfunc() assumes that "module" attribute of
ast.ImportFrom is None for "from . import a", and Python 2.7.x
satisfies this assumption.

On the other hand, with Python 2.6.x, "module" attribute of
ast.ImportFrom is an empty string for "from . import a", and this
causes failure of test-check-module-imports.t.
2016-06-19 02:15:09 +09:00
Yuya Nishihara
36bce4885c chg: ignore SIGINT while waiting pager termination
Otherwise the terminal would be left with unclean state. This is what
ea9ab1ca7e38 does.
2016-06-15 23:49:56 +09:00
Yuya Nishihara
ca4a132300 chg: reset signal handlers to default before waiting pager
Our signal handlers forward signals to the server process, but it will
disappear soon after hgc_close(). So we should unregister handlers before
hgc_close(). Otherwise chg would abort due to kill(perrpid, sig) failure.

The problem is spotted by SIGWINCH while waiting pager termination.
2016-06-15 23:32:00 +09:00
Jun Wu
18674dc0d2 chg: change default connect timeout to 60 seconds
As discussed at
https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-June/085290.html

The default 10-second timeout is not enough if the machine is overloaded.
Let's increase it to 60 seconds.
2016-06-15 21:36:31 +01:00
Jun Wu
eacf673970 chg: make timeout adjustable
Before this patch, chg will give up when it cannot connect to the new server
within 10 seconds. If the host has high load during that time, 10 seconds
is not enough.

This patch makes it adjustable using the CHGTIMEOUT environment variable.
2016-06-13 21:30:14 +01:00
Jun Wu
7c2dd6af83 chg: exec pager in child process
Before this patch, chg uses the old pager behavior (pre 55f6f7fb60d2), which
executes pager in the main process. The user will see the exit code of the
pager, instead of the hg command.

Like 55f6f7fb60d2, this patch fixes the behavior by executing the pager in
the child process, and wait for it at the end of the main process.
2016-06-11 20:25:49 +01:00
Yuya Nishihara
1ebacc86b6 check-code: make 'ls' pattern less invasive
I got false positive at "--tls smtps --certificate ...".
2016-05-31 21:49:49 +09:00
FUJIWARA Katsunori
6b3350290a check-code: make repquote distinguish more characters for exact detection
This patch makes repquote() distinguish more characters below, as a
preparation for exact detection in subsequent patch.

  - "%"  as "%"
  - "\\" as "b"(ackslash)
  - "*"  as "A"(sterisk)
  - "+"  as "P"(lus)
  - "-"  as "M"(inus)

Characters other than "%" don't use itself as replacement, because
they are treated as special ones in regexp.
2016-05-31 21:02:30 +09:00
FUJIWARA Katsunori
2a401a73fb check-code: centralize rules depending on implementation of repquote
This decreases the cost of checking which regexp should be adjusted at
change of repquote().
2016-05-31 21:02:30 +09:00
FUJIWARA Katsunori
d7e9d8ec44 check-code: use fixedmap for replacement of space characters
This can centralize management of fixed replacement into fixedmap.
2016-05-31 21:02:30 +09:00
FUJIWARA Katsunori
dfdbfa6418 check-code: replace quoted characters correctly
d19c9c93ad10 tried to detect '.. note::' more exactly. But
implementation of it seems not correct, because:

  - fromc.find(c) returns -1 for other than "." and ":"
  - tochr[-1] returns "q" for such characters, but
  - expected result for them is "o"

This patch uses dict to manage replacement instead of replacing
str.find() by str.index(), for improvement/refactoring in subsequent
patches. Examination by fixedmap is placed just after examination for
' ' and '\n', because subsequent patch will integrate the latter into
the former.

This patch also changes regexp for 'string join across lines with no
space' rule, and adds detailed test for it, because d19c9c93ad10 did:

  - make repquote() distinguish "." (as "p") and ":" (as "q") from
    others (as "o"), but

  - not change this regexp without any reason (in commit log, at
    least), even though this regexp depends on what "o" means

This patch doesn't focuses on deciding whether "." and/or ":" should
be followed by whitespace or not in translatable messages.
2016-05-31 20:58:10 +09:00
Yuya Nishihara
ff61ad577d tests: enable import checker for all python files (including no .py files)
i18n/posplit is excluded as it couldn't be trivially fixed. That's the same
as ade93acee2d6.
2016-05-15 10:48:05 +09:00
timeless
6f5c7d50da check-code: reject .next(...) 2016-05-16 21:18:59 +00: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
Yuya Nishihara
7bd38d257c py3: make contrib/import-checker.py get along with itself
Indent these imports to disable the rule of "not lexically sorted."
2016-05-14 14:33:45 +09:00
Yuya Nishihara
9757d7bd19 py3: make contrib/revsetbenchmarks.py not import symbols from stdlib modules 2016-05-14 14:23:04 +09:00
Yuya Nishihara
d87fcccd78 py3: make contrib/bdiff-torture.py conform to our import style 2016-05-14 14:18:15 +09:00
Yuya Nishihara
e5d8ee2999 import-checker: extend check of symbol-import order to all local modules
It doesn't make sense that (a) is allowed whereas (b) is disallowed.

 a) from mercurial import hg
    from mercurial.i18n import _

 b) from . import hg
    from .i18n import _
2016-05-14 13:39:33 +09:00
Yuya Nishihara
a97969202f import-checker: always build a list of imported symbols
The next patch will rely on it.
2016-05-14 13:20:13 +09:00
Yuya Nishihara
a5c934df3c py3: move up symbol imports to enforce import-checker rules
Since (b) is banned, we should do the same for (a) for consistency.

 a) from mercurial import hg
    from mercurial.i18n import _

 b) from . import hg
    from .i18n import _
2016-05-14 14:03:12 +09:00
Matt Mackall
a24591e84c merge with stable 2016-05-17 11:28:46 -05:00
Sean Farley
b611d5489b builddeb: add distroseries to tagged versions
This is needed so that launchpad and friends have a unique version number for
each distroseries (trusty, wily, xenial, etc). It was discovered when trying to
upload 3.8 to launchpad.
2016-05-06 14:09:11 -07:00
Sean Farley
3b8b645648 debian: forgot to make debian/rules executable in 9dad5512e855 2016-05-01 15:26:41 -07:00
Sean Farley
a260b9c4ef debian: add wish to suggests
Debian maintainers already have this and lintian warns us about not
listing 'wish' as a dependency or suggestion so this patch does indeed
just that. The issue, by the way, is that we are shipping hgk (which is
written in tcl/tk) so we should be good citizens and list wish (a meta
package for tcl/tk) as a dependency.
2016-04-30 21:21:34 -07:00
Sean Farley
41d6e5ed5b debian: alphabetize build deps 2016-04-30 21:21:17 -07:00
Sean Farley
35d3b6884b debian: fix lintian warning about debhelper
It seems this is correct but does it work on older distros? I ran the
docker-jessie rule and didn't get any warnings.
2016-04-30 17:26:48 -07:00
Sean Farley
8b7c1af14d builddeb: remove chmod as lintian tells us
It turns out we just need debian/rules to be executable, so we do just that.
2016-04-30 17:29:12 -07:00
Sean Farley
205b5f811e builddeb: use codename in version
Apparently, this is needed to allow ppas to be built for multiple distros.
2016-04-30 11:51:45 -07:00
Sean Farley
bf3866fc9f make: turn ubuntu docker into template
This allows us to easily add more ubuntu docker targets (which following
patches will do).

Also, we no longer need the mkdir command.
2016-04-26 23:33:17 -07:00
Kevin Bullock
971fb62b26 osx: create a modern package including manpages
Instead of using bdist_mpkg, we use the modern Apple-provided tools to
build an OS X Installer package directly. This has several advantages:

* Avoids bdist_mpkg which seems to be barely maintained and is hard to
  use.
* Creates a single unified .pkg instead of a .mpkg.
* The package we produce is in the modern, single-file format instead of
  a directory bundle that we have to zip up for download.

In addition, this way of building the package now correctly:

* Installs the manpages, bringing the `make osx`-generated package in
  line with the official Mac packages we publish on the website.
* Installs files with the correct permissions instead of encoding the
  UID of the user who happened to build the package.

Thanks to Augie for updating the test expectations.
2016-04-27 10:20:36 -05:00
Yuya Nishihara
c61ec06302 chg: initialize sockdirfd to -1 instead of AT_FDCWD
As we don't use sockdirfd yet, this is the simplest workaround to compile chg
on old Unices where AT_FDCWD does not exist. Foozy pointed out Mac OS X 10.10
is required for AT_FDCWD as well as xxxat() functions.
2016-04-24 21:35:30 +09:00
Matt Mackall
01fb35972f bdiff: fix latent normalization bug
This bug is hidden by the current bias towards matches at the
beginning of the file. When this bias is tweaked later to address
recursion balancing, the normalization code could cause the next block
to shrink to a negative length, thus creating invalid delta chunks. We
add checks here to disallow that.

This bug requires test cases that are an awkwardly large size for the test
suite, but is very rapidly picked up by the included torture tester.
2016-04-21 21:53:18 -05:00
Pulkit Goyal
053345912e py3: make contrib/undumprevlog use absolute_import 2016-05-13 02:23:45 +05:30
Pulkit Goyal
b9bf08a95b py3: make contrib/dumprevlog use print_function 2016-05-13 02:16:32 +05:30
Pulkit Goyal
e3059e69d7 py3: make contrib/dumprevlog use absolute_import 2016-05-13 02:14:49 +05:30
Pulkit Goyal
549af99ee9 py3: make contrib/check-commit use print_function 2016-05-13 02:13:14 +05:30
Pulkit Goyal
83f98391f1 py3: make contrib/check-commit use absolute_import 2016-05-13 02:11:57 +05:30
Jun Wu
1c8f26818c hgcia: remove hgcia (BC)
As discussed at:
https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-March/081018.html,
cia service is down for years. It also uses socket.setdefaulttimeout() which
will break chg. This patch removes the extension.
2016-05-12 01:03:19 +01:00
timeless
1ba2701c7e check-code: handle py3 open divergence
open() really wants an encoding attribute
2016-05-11 01:46:11 +00:00
timeless
fad5dd9e3e check-code: switch to opener 2016-05-11 01:44:39 +00:00
timeless
9bdcc0acc5 check-code: handle range/xrange divergence 2016-05-11 01:39:07 +00:00
timeless
afe01e4291 check-code: fix py3 complaint about \NNN being invalid unicode 2016-05-11 01:56:08 +00:00