Commit Graph

1931 Commits

Author SHA1 Message Date
Anton Shestakov
36cf1f5e53 zsh_completion: update some option usage flags ('+', '=' and ':')
Here are the relevant symbol descriptions from [0]

optspec:...
  The colon indicates handling for one or more arguments to the option; if it
  is not present, the option is assumed to take no arguments.

-optname+
  The first argument may appear immediately after optname in the same word,
  or may appear as a separate word after the option. For example, ‘-foo+:...’
  specifies that the completed option and argument will look like either
  ‘-fooarg’ or ‘-foo arg’.

-optname=
  The argument may appear as the next word, or in same word as the option
  name provided that it is separated from it by an equals sign, for example
  ‘-foo=arg’ or ‘-foo arg’.

There are 3 types of changes in this patch:

- addition of '=': means that '--repository ~/foo' can now also be spelled as
  '--reporitory=~/foo'

- addition of '+': means '-r 0' can now also be spelled as '-r0'

- removal of '+', '=' and ':': means that '-u|--untrusted' doesn't take any
  arguments, so '-uq' is definitely '-u -q' and not '--untrusted=q'

Occasionally, ':' had to be added together with '=' and '+'.

This patch is mostly just making zsh_completion file look more like zsh's own
hg completion file so that we can more easily take improvements from them or
send patches to them. Some context for this patch from zsh project: [2] [3].

[0]: http://zsh.sourceforge.net/Doc/Release/Completion-System.html
[1]: https://sourceforge.net/p/zsh/code/ci/master/tree/Completion/Unix/Command/_hg
[2]: 92584634d3/
[3]: http://www.zsh.org/mla/workers/2015/msg02551.html
2016-10-04 20:49:59 +08:00
Pierre-Yves David
21997e4a02 perf: release lock after transaction in perffncachewrite
The transaction should be closed within the lock.
2016-08-11 14:51:19 +02:00
Mathias De Maré
ffcbeb8c14 check-commit: allow underscore as commit topic
It's currently not possible to commit with a changeset topic
like 'bash_completion'. This change fixes that.
2016-10-05 15:28:34 +02:00
Gregory Szorc
55983533a4 perf: add perfchangegroupchangelog command
This command can be used for testing the performance of producing the
changelog portion of a changegroup.

We could use additional perf* commands for testing other parts of
changegroup. Those can be written another time, when they are needed.
(And those may want to refactor the changegroup generation API so code
can be reused.) Speaking of code reuse, yes, this command does reinvent
a small wheel. I didn't want to scope bloat to change the changegroup
API because that will invite bikeshedding.
2016-09-24 12:22:30 -07:00
Gregory Szorc
46efca30f4 perf: add --reverse to perfrevlog
It can be useful to know how fast we can read revisions from a revlog
in reverse. This operation tends to occur in `hg log` commands,
for example.
2016-09-24 10:44:37 -07:00
Gregory Szorc
5c136c2209 help: internals topic for wire protocol
The Mercurial wire protocol is under-documented. This includes a lack
of source docstrings and comments as well as pages on the official
wiki.

This patch adds the beginnings of "internals" documentation on the
wire protocol.

The documentation should have nearly complete coverage on the
lower-level parts of the protocol, such as the different transport
mechanims, how commands and arguments are sent, capabilities, and,
of course, the commands themselves.

As part of writing this documentation, I discovered a number of
deficiencies in the protocol and bugs in the implementation. I've
started sending patches for some of the issues. I hope to send a lot
more.

This patch starts with the scaffolding for a new internals page.
2016-08-22 19:46:39 -07:00
Augie Fackler
4e1c384d0a extensions: change magic "shipped with hg" string
I've caught multiple extensions in the wild lying about being
'internal', so it's time to move the goalposts on people. Goalpost
moving will continue until third party extensions stop trying to
defeat the system.
2016-08-23 11:26:08 -04:00
Yuya Nishihara
065c8a0e60 check-code: allow assignment to hasattr variable 2016-08-16 17:15:54 +09:00
Yuya Nishihara
9a45df1ce7 check-code: make dict() pattern less invasive
'foodict(x=y)' should be allowed.
2016-08-15 17:17:39 +09:00
Augie Fackler
cb268cbd2f merge with stable 2016-08-15 12:26:02 -04:00
Anton Shestakov
f42d0025b8 osx: update bugzilla link in readme 2016-08-04 19:53:46 +08:00
Anton Shestakov
7f3760e482 win32: update link to mailing list in readme 2016-08-04 19:50:25 +08:00
Anton Shestakov
c30efef3cd win32: update wiki link in mercurial.ini 2016-08-04 19:50:06 +08:00
Anton Shestakov
2ffd028d67 debian: update source URL in copyright file 2016-08-04 19:49:07 +08:00
Pierre-Yves David
89eafebd2c packagelib: do not remove packages directory in hggetversion (issue5262)
People running packages related code probably do care about the content of this
directory. In particular this shound fix the rpm builder process.
2016-07-29 00:45:24 +02:00
Jun Wu
997125affe chg: forward SIGINT, SIGHUP to process group
These signals are meant to send to a process group, instead of a single
process: SIGINT is usually emitted by the terminal and sent to the process
group. SIGHUP usually happens to a process group if termination of a process
causes that process group to become orphaned.

Before this patch, chg will only forward these signals to the single server
process. This patch changes it to the server process group.

This will allow us to properly kill processes started by the forked server
process, like a ssh process. The behavior difference can be observed by
setting SSH_ASKPASS to a dummy script doing "sleep 100" and then run
"chg push ssh://dest-need-password-auth". Before this patch, the first Ctrl+C
will kill the hg process while ssh-askpass and ssh will remain alive. This
patch will make sure they are killed properly.
2016-07-17 22:55:47 +01:00
Jun Wu
ecf32d3bf2 chg: handle EOF reading data block
We recently discovered a case in production that chg uses 100% CPU and is
trying to read data forever:

  recvfrom(4, "", 1814012019, 0, NULL, NULL) = 0

Using gdb, apparently readchannel() got wrong data. It was reading in an
infinite loop because rsize == 0 does not exit the loop, while the server
process had ended.

  (gdb) bt
  #0 ... in recv () at /lib64/libc.so.6
  #1 ... in readchannel (...) at /usr/include/bits/socket2.h:45
  #2 ... in readchannel (hgc=...) at hgclient.c:129
  #3 ... in handleresponse (hgc=...) at hgclient.c:255
  #4 ... in hgc_runcommand (hgc=..., args=<optimized>, argsize=<optimized>)
  #5 ... in main (argc=...486922636, argv=..., envp=...) at chg.c:661
  (gdb) frame 2
  (gdb) p *hgc
  $1 = {sockfd = 4, pid = 381152, ctx = {ch = 108 'l',
        data = 0x7fb05164f010 "st):\nTraceback (most recent call last):\n"
        "Traceback (most recent call last):\ne", maxdatasize = 1814065152,"
        " datasize = 1814064225}, capflags = 16131}

This patch addresses the infinite loop issue by detecting continuously empty
responses and abort in that case.

Note that datasize can be translated to ['l', ' ', 'l', 'a']. Concatenate
datasize and data, it forms part of "Traceback (most recent call last):".

This may indicate a server-side channeledoutput issue. If it is a race
condition, we may want to use flock to protect the channels.
2016-07-18 18:55:06 +01:00
Jun Wu
2106a129bc chg: add pgid to hgclient struct
The previous patch makes the server tell the client its pgid. This patch
stores it in hgclient_t and adds a function to get it.
2016-07-17 23:05:59 +01:00
FUJIWARA Katsunori
9dfb60275e check-code: move fixing up regexp into main procedure
This patch makes an extra check pattern to be prepared by
"_preparepats()" as similarly as existing patterns, if it is added to
"checks" array before invocation of "main()" in check-code.py.

This is a part of preparation for adding check-code.py extra checks by
another python script in subsequent patch.

This is also useful for SkeletonExtensionPlan.

    https://www.mercurial-scm.org/wiki/SkeletonExtensionPlan
2016-05-20 09:47:35 +09:00
FUJIWARA Katsunori
0a9f5e8b83 check-code: factor out boot procedure into main
This is a part of preparation for adding check-code.py extra checks by
another python script in subsequent patch.

This is also useful for SkeletonExtensionPlan.

    https://www.mercurial-scm.org/wiki/SkeletonExtensionPlan
2016-05-20 09:47:35 +09:00
FUJIWARA Katsunori
8bd5aefb64 perf: import newer modules separately for earlier Mercurial
demandimport of early Mercurial loads an imported module immediately,
if a module is imported absolutely by "from a import b" style. Recent
perf.py satisfies this condition, because it does:

  - have "from __future__ import absolute_import" line
  - use "from a import b" style for modules in "mercurial" package

Before this patch, importing modules below prevents perf.py from being
loaded by earlier Mercurial, because these aren't available in such
Mercurial, even though there are some code paths for Mercurial earlier
than 1.9.

  - branchmap 2.5 (or e3354ba12eef)
  - repoview  2.5 (or 7d207cb7e38a)
  - obsolete  2.3 (or b50a017cd9ac)
  - scmutil   1.9 (or 065064cdde5f)

For example, setting "_prereadsize" attribute in perfindex() and
perfnodelookup() is effective only with Mercurial earlier than 1.8 (or
1299f0c14572).

After this patch, "mercurial.error" is the only blocker in "from
mercurial import" statement for loading perf.py with Mercurial earlier
than 1.2. This patch ignores it, because just importing it separately
isn't enough.
2016-05-20 09:47:35 +09:00
Pulkit Goyal
6b3bc52b40 py3: conditionalize BaseHTTPServer, SimpleHTTPServer and CGIHTTPServer import
The BaseHTTPServer, SimpleHTTPServer and CGIHTTPServer has been merged into
http.server in python 3. All of them has been merged as util.httpserver to use
in both python 2 and 3. This patch adds a regex to check-code to warn against
the use of BaseHTTPServer. Moreover this patch also includes updates to lower
part of test-check-py3-compat.t which used to remain unchanged.
2016-07-13 23:38:29 +05:30
Gregory Szorc
2125e5d7d4 mercurial: implement a source transforming module loader on Python 3
The most painful part of ensuring Python code runs on both Python 2
and 3 is string encoding. Making this difficult is that string
literals in Python 2 are bytes and string literals in Python 3 are
unicode. So, to ensure consistent types are used, you have to
use "from __future__ import unicode_literals" and/or prefix literals
with their type (e.g. b'foo' or u'foo').

Nearly every string in Mercurial is bytes. So, to use the same source
code on both Python 2 and 3 would require prefixing nearly every
string literal with "b" to make it a byte literal. This is ugly and
not something mpm is willing to do at this point in time.

This patch implements a custom module loader on Python 3 that performs
source transformation to convert string literals (unicode in Python 3)
to byte literals. In effect, it changes Python 3's string literals to
behave like Python 2's.

In addition, the module loader recognizes well-known built-in
functions (getattr, setattr, hasattr) and methods (encode and decode)
that barf when bytes are used and prevents these from being rewritten.
This prevents excessive source changes to accommodate this change
(we would have to rewrite every occurrence of these functions passing
string literals otherwise).

The module loader is only used on Python packages belonging to
Mercurial.

The loader works by tokenizing the loaded source and replacing
"string" tokens if necessary. The modified token stream is
untokenized back to source and loaded like normal. This does add some
overhead. However, this all occurs before caching: .pyc files will
cache the transformed version. This means the transformation penalty
is only paid on first load.

As the extensive inline comments explain, the presence of a custom
source transformer invalidates assumptions made by Python's built-in
bytecode caching mechanism. So, we have to wrap bytecode loading and
writing and add an additional header to bytecode files to facilitate
additional cache validation when the source transformations
change in the future.

There are still a few things this code doesn't handle well, namely
support for zip files as module sources and for extensions. Since
Mercurial doesn't officially support Python 3 yet, I'm inclined to
leave these as to-do items: getting a basic module loading mechanism
in place to unblock further Python 3 porting effort is more important
than comprehensive module importing support.

check-py3-compat.py has been updated to ignore frames. This is
necessary because CPython has built-in code to strip frames from the
built-in importer. When our custom code is present, this doesn't work
and the frames get all messed up. The new code is not perfect. It
works for now. But once you start chasing import failures you find
some edge cases where the files aren't being printed properly. This
only burdens people doing future Python 3 porting work so I'm inclined
to punt on the issue: the most important thing is for the source
transforming module loader to land.

There was a bit of churn in test-check-py3-compat.t because we now
trip up on str/unicode/bytes failures as a result of source
transformation. This is unfortunate but what are you going to do.

It's worth noting that other approaches were investigated.

We considered using a custom file encoding whose decode() would
apply source transformations. This was rejected because it would
require each source file to declare its custom Mercurial encoding.
Furthermore, when changing the source transformation we'd need to
version bump the encoding name otherwise the module caching layer
wouldn't know the .pyc file was invalidated. This would mean mass
updating every file when the source transformation changes. Yuck.

We also considered transforming at the AST layer. However, Python's
ast module is quite gnarly and doing AST transforms is quite
complicated, even for trivial rewrites. There are whole Python packages
that exist to make AST transformations usable. AST transforms would
still require import machinery, so the choice was basically to
perform source-level, token-level, or ast-level transforms.

Token-level rewriting delivers the metadata we need to rewrite
intelligently while being relatively easy to understand. So it won.

General consensus seems to be that this approach is the best available
to avoid bulk rewriting of '' to b''. However, we aren't confident
that this approach will never be a future maintenance burden. This
approach does unblock serious Python 3 porting efforts. So we can
re-evaulate once more work is done to support Python 3.
2016-07-04 11:18:03 -07:00
Augie Fackler
ceba27d835 osx: correct comment about ordering of welcome page 2016-07-13 11:26:44 -04:00
Augie Fackler
7db40cdbbf osx: jettison outdated build instructions 2016-07-13 11:24:31 -04:00
Augie Fackler
917aac8fd9 check-code: enforce (glob) on output lines containing 127.0.0.1 2016-07-09 23:04:03 -04:00
Augie Fackler
2bd6c4334d check-code: only treat a # as a line in a t-test if it has a space before it
Prior to this, check-code wouldn't notice things like (glob)
annotations or similar in a test if they were after a # anywhere in
the line. This resolves a defect in a future change, and also exposed
a couple of small spots that needed some attention.
2016-07-12 15:34:17 -04:00
FUJIWARA Katsunori
6fdee58a92 perf: define command annotation locally for Mercurial earlier than 3.1
Before this patch, using cmdutil.command() for "@command" annotation
prevents perf.py from being loaded by Mercurial earlier than 1.9 (or
d4096ee63f8e), because cmdutil.command() isn't available in such
Mercurial, even though there are some code paths for Mercurial earlier
than 1.9.

For example, setting "_prereadsize" attribute in perfindex() and
perfnodelookup() is effective only with hg earlier than 1.8 (or
1299f0c14572).

In addition to it, "norepo" option of command annotation has been
available since 3.1 (or 9cbb59f03d57), and this is another blocker for
loading perf.py with earlier Mercurial.

  ============ ============ ======
               command of
  hg version   cmdutil      norepo
  ============ ============ ======
  3.1 or later      o         o
  1.9 or later      o         x
  earlier           x         x
  ============ ============ ======

This patch defines "command()" for annotation locally as below:

  - define wrapper of existing cmdutil.command(), if cmdutil.command()
    doesn't support "norepo"
    (for Mercurial earlier than 3.1)

  - define full command() locally with minimum function, if
    cmdutil.command() isn't available at runtime
    (for Mercurial earlier than 1.9)

This patch also defines parsealiases() locally without examining
whether it is available or not, because it is small enough to define
locally.
2016-07-05 07:25:51 +09:00
FUJIWARA Katsunori
a838d26c49 perf: avoid using formatteropts for Mercurial earlier than 3.2
Before this patch, referring commands.formatteropts prevents perf.py
from being loaded by Mercurial earlier than 3.2 (or 44a82ed65df7),
because it isn't available in such Mercurial, even though formatting
itself has been available since 2.2 (or 045c8375c770).

In addition to it, there are some code paths for Mercurial earlier
than 3.2. For example, setting "_prereadsize" attribute in perfindex()
and perfnodelookup() is effective only with hg earlier than 1.8 (or
1299f0c14572).

This patch uses empty option list as formatteropts, if it isn't
available in commands module at runtime.

Disabling -T/--template option for earlier Mercurial should be
reasonable, because:

  - since 0c03b2a1206a, -T/--template for formatter has been available
  - since 44a82ed65df7, commands.formatteropts has been available
  - the latter revision is direct child of the former
2016-07-05 07:25:51 +09:00
FUJIWARA Katsunori
4875ebeb0e perf: use locally defined revlog option list for Mercurial earlier than 3.7
Before this patch, referring commands.debugrevlogopts prevents perf.py
from being loaded by Mercurial earlier than 3.7 (or 1a89336e03aa),
because it isn't available in such Mercurial, even though
cmdutil.openrevlog(), a user of these options, has been available
since 1.9 (or f32fd7cab084).

In addition to it, there are some code paths for Mercurial earlier
than 3.7. For example, setting "_prereadsize" attribute in perfindex()
and perfnodelookup() is effective only with hg earlier than 1.8 (or
1299f0c14572).

But just "using locally defined revlog option list" might cause
unexpected behavior at runtime. If --dir option is specified to
cmdutil.openrevlog() of Mercurial earlier than 3.5 (or e3ab0b30c05e),
it is silently ignored without any warning or so.

  ============ ============ ===== ===============
                                  debugrevlogopts
  hg version   openrevlog() --dir of commands
  ============ ============ ===== ===============
  3.7 or later     o          o         o
  3.5 or later     o          o         x
  1.9 or later     o          x         x
  earlier          x          x         x
  ============ ============ ===== ===============

Therefore, this patch does:

  - use locally defined option list, if commands.debugrevlogopts isn't
    available (for Mercurial earlier than 3.7)

  - wrap cmdutil.openrevlog(), if it is ambiguous whether
    cmdutil.openrevlog() can recognize --dir option correctly
    (for Mercurial earlier than 3.5)

    This wrapper function aborts execution, if:
    - --dir option is specified, and
    - localrepository doesn't have "dirlog" attribute, which indicates
      that localrepository has a function for '--dir'

    BTW, extensions.wrapfunction() has been available since 1.1 (or
    56ba0b824b91), and this seems old enough for "historical
    portability" of perf.py, which has been available since 1.1 (or
    bca5e7427e89).
2016-07-05 07:25:51 +09:00
FUJIWARA Katsunori
51a99ac996 perf: define util.safehasattr forcibly for Mercurial earlier than 1.9.3
Before this patch, using util.safehasattr() prevents perf.py from
being loaded by Mercurial earlier than 1.9.3 (or 36f152380d7d),
because util.safehasattr() isn't available in such Mercurial, even
though there are some code paths for Mercurial earlier than 1.9.3.

For example, setting "_prereadsize" attribute in perfindex() and
perfnodelookup() is effective only with Mercurial earlier than 1.8 (or
1299f0c14572).

This patch is a preparation for using util.safehasattr() safely in
subsequent patches.

This patch defines util.safehasattr() forcibly without examining
whether it is available or not, because:

  - examining existence of "safehasattr" safely itself needs similar logic
  - safehasattr() is small enough to define locally
2016-07-05 07:25:51 +09:00
FUJIWARA Katsunori
75253dece2 perf: add historical portability policy for future reference 2016-07-05 07:25:51 +09:00
Pulkit Goyal
af9d7f66d0 py3: conditionalize httplib import
The httplib library is renamed to http.client in python 3. So the
import is conditionalized and a test is added in check-code to warn
to use util.httplib
2016-06-28 16:01:53 +05:30
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
Kevin Bullock
2224f08289 check-code: add a rule banning env -u 2016-05-06 08:45:56 -05:00
liscju
1283887937 import-checker: recognize relative imports from parents of current package
So far fromlocal recognizes relative imports of the form:
from . import D
from .. import E

It wasn't prepared for recognizing relative imports like:
from ..F import G

The bug was not found so far because all relative imports starting
from the parent was in the list of allowsymbolicimports like:
from ..i18n import
from ..node import
2016-05-07 19:59:30 +02:00
Pierre-Yves David
3ff9373dab devel: use the 'config' argument for the dirstate normalisation develwarn 2016-05-08 10:43:41 +02:00
FUJIWARA Katsunori
d0610552d6 py3: make check-py3-compat.py use correct module name at loading pure modules
Before this patch, check-py3-compat.py implies unintentional ".pure"
sub-package name at loading pure modules, because module name is
composed by just replacing "/" in the path to actual ".py" file by
".".

This makes pure modules belong to "mercurial.pure" package, and
prevents them from importing a module belonging to "mercurial" package
relatively by "from . import foo" or so.

This is reason why pure modules fail to import another module
relatively only at examination by check-py3-compat.py.
2016-08-09 02:28:34 +09:00
Yuya Nishihara
6c0a0f348a chg: just take it as EOF if recv() returns 0
hgc->sockfd is a blocking stream socket. recv() should never return 0 other
than EOF.

See 4ff8628991ea for the original problem.
2016-08-05 21:21:33 +09:00
Augie Fackler
127114bb19 check-commit: allow underbars in cffi_-prefix function names
It seems reasonable to give cffi functions slightly more verbose names
in some circumstances, given the way they interface with C.
2016-08-05 17:27:51 -04:00
Sean Farley
68327cd0d7 dockerdeb: pass the rest of the args to the builder script
It seems this was the original intent of the script so this patch passes the
remanining arguments to builddeb.
2016-04-23 12:47:57 -07:00
Sean Farley
b338df1c3a dockerdeb: fix incorrect number of shifts
From the comment, it appears that the original intent was to remove the first
two arguments, so this patch does just that.
2016-04-23 12:47:39 -07:00
Sean Farley
2ae42c9c04 builddeb: add flag for a source-only deb
This is required for building a ppa for ubuntu which following patches will
use.
2016-04-16 13:01:47 -07:00
Sean Farley
ac64faac8c builddeb: create source archive for ubuntu 2016-04-16 17:06:11 -07:00
Sean Farley
86966707e3 builddeb: ignore vcs and build results
This one is a no-brainer. Previously, if you tried to build a deb on ubuntu, it
would try to diff files in the .hg store. These flags prevent that.
2016-04-15 15:44:00 -07:00
Sean Farley
2aa8466d25 builddeb: copy over .gz and .dsc files
We were forgetting to copy over the signature (if it exists) and the zipped
diff, so let's do that.
2016-04-15 14:28:26 -07:00
Sean Farley
738ce5394f builddeb: ignore errors about find not finding files
The debuild command may output less files than we explicitly list so let's not
error out if none exist.
2016-04-15 14:27:42 -07:00
Sean Farley
cf4a77c8c0 builddeb: use the os codename instead of 'unstable'
This fixes a lintian error (and indeed, launchpad rejects it) by using the
distribution's codename (e.g. xenial, trusty, etc).
2016-04-16 12:42:53 -07:00
Sean Farley
71e02dfaad builddeb: use sed -i
Notice that there is no space after '-i'. This makes it work on both GNU and
BSD versions of sed.
2016-04-16 12:33:21 -07:00
Sean Farley
aa0d445553 dockerdeb: redirect 'cd' in export command to /dev/null
This had the unfortunate side effect of causing the environment to have a
newline due to the fact that some 'cd' outputs the result of the directory
change. So, let's just redirect the meaningless output.
2016-04-17 10:36:40 -07:00
Sean Farley
24f7624e5e debian: add missing netbase dependency
Apparently, some machines don't have this service (launchpad builders are one
such example). This adds the correct dependency for test-serve.t.
2016-04-17 10:39:17 -07:00
Sean Farley
11b650fc97 debian: add missing zip/unzip dependencies 2016-04-16 14:24:25 -07:00
Sean Farley
278c6cac50 debian: add missing python-docutils dependency 2016-04-15 13:53:23 -07:00
Sean Farley
10771f89cc debian: add missing python-all-dev dependency 2016-04-15 13:46:16 -07:00
Jun Wu
837ef17e43 chg: forward SIGWINCH to worker
Before this patch, if the user uses chg and ncurses interface, resizing the
terminal window will mess up its content.

This patch fixes the issue by forwarding SIGWINCH to the worker process.
2016-04-10 01:28:52 +01:00
timeless
9af2e630f0 import-checker: parse python code from .t files 2016-04-12 21:43:56 +00:00
timeless
103d337d89 import-checker: track filenames for SyntaxErrors 2016-04-13 16:34:59 +00:00
timeless
37896a9aaf import-checker: track SyntaxErrors
We don't really need to report SyntaxErrors, since in theory
docchecker or a test will catch them, but they happen, and
we can't just have the code crash, so for now, we're reporting
them.
2016-04-13 16:36:19 +00:00
timeless
36d6fb58ef import-checker: refactor source reading
This will allow .t files to generate multiple sources.
It will also allow .py doctests to generate additional sources.
2016-04-11 22:34:04 +00:00
timeless
93c46657f1 check-code: reject import urllib 2016-04-07 00:34:07 +00:00
Jun Wu
63d1d02bc9 chg: server exited with code 0 without being connectable is an error
Before this patch, if the server started by chg has exited with code 0 without
creating a connectable unix domain socket at the specified address, chg will
exit with code 0, which is not the correct behavior. It can happen, for
example, CHGHG is set to /bin/true.

This patch addresses the issue by checking the exit code of the server and
printing a new error message if the server exited normally but cannot be
reached.
2016-04-10 22:00:34 +01:00
Jun Wu
fda8134cfd chg: use fsetcloexec instead of closing lockfd manually
Since we have the fsetcloexec utility function, use it instead of closing
lockfd manually.
2016-04-11 00:18:27 +01:00
Jun Wu
f8e2eeaa6b chg: extract the logic of setting FD_CLOEXEC to a utility function
Setting FD_CLOEXEC is useful for other fds such like lockfd and sockdirfd,
move the logic from hgc_open to util.
2016-04-11 00:17:17 +01:00
Jun Wu
b8937b0692 chg: add fchdirx as a utility function
As part of the series to support long socket paths, we need to use fchdir and
check its result in several places. Make it a utility function.
2016-04-10 03:14:32 +01:00
Jun Wu
bfa0407ff7 chg: check lockfd at freecmdserveropts
We check for sockdirfd at freecmdserveropts but not lockfd, which is a bit
strange to people new to the code. Add a comment and an assert to make it
clear that lockfd should be closed earlier.
2016-04-10 22:58:11 +01:00
Jun Wu
625c1b8ab3 chg: add sockdirfd to cmdserveropts
As part of the series to support long socket paths, we need to add the fd of
the directory to the cmdserveropts structure so we can use basenames instead
of full paths for sockname, redirectsockname, and lockfile.
2016-04-10 23:56:00 +01:00
Jun Wu
29846cf694 chg: fix spelling in the error message about error waiting for cmdserver
This is a trivial spelling and grammar fix.
2016-04-10 21:56:05 +01:00
timeless
edef054d1b test-commandserver: handle cStringIO.StringIO/io.StringIO divergence 2016-04-06 20:34:34 +00:00
timeless
bc7ecb0989 check-code: reject import Queue, suggest util.queue class for py3 compat 2016-04-06 20:08:18 +00:00
Jun Wu
e2b3016869 chg: wrap line at 80 chars
This is a style fix. I was using tabstop=4 for some early patches, although
I realized we use tabstop=8 later but these early style issues remains. Let's
fix them.
2016-04-05 17:43:02 +01:00
Jun Wu
7aec0cb63d chg: replace abortmsg showing errno with abortmsgerrno
Since we have abortmsgerrno now, use it to show human friendly error messages
across platforms.
2016-04-05 15:16:01 +01:00
Jun Wu
0a8e7312da chg: add util function abortmsgerrno to print error with errno
It's common to abortmsg with the errno information. Let's make a utility
function for it.
2016-04-05 17:25:39 +01:00
Jun Wu
24134cf0dd chg: use color in debug/error messages conditionally
Before this patch, chg always uses color in its debugmsg and abortmsg and
there is no way to turn it off.

This patch adds a global flag to control whether chg should use color or
not and only enables it when stderr is a tty and HGPLAIN is not set.
2016-04-05 14:48:09 +01:00
timeless
52801a4e4b check-code: reject sed ... \\n
This would have caught cfe13eb3c333 (fixed by 34113b609b05)
if repcomment didn't make the content of the perl code
opaque to the check.
2016-03-30 22:01:47 +00:00
Jun Wu
9c2bea1fcf chg: make connect debug message less repetitive
Before this patch, "connect to" debug message is printed repeatedly because
a previous patch changed how the chg client decides the server is ready to be
connected.

This patch revises the places we print connect debug messages so they are less
repetitive without losing useful information.
2016-04-04 02:36:05 +01:00
Maciej Fijalkowski
eb8f037251 tests: fix builtin module test on pypy
On pypy datetime and cProfile are modules written in Python, not in C.
For the purpose of this test, just list them explicitely as builtins,
which silences warnings about them being imported before stdlib modules.
2016-03-30 21:54:26 +02:00
timeless
cb70588e15 py3: handle iter/iterkeys+iteritems python3 divergence in import-checker 2016-03-30 08:15:37 +00:00
timeless
14b03acded py3: use print_function in import-checker 2016-03-30 04:55:16 +00:00
timeless
9580d303e6 py3: use absolute_import in import-checker 2016-03-30 04:50:19 +00:00
timeless
250ff767cf py24: remove check-code py24 notation
We require python2.6+
2016-03-30 07:24:51 +00:00
Anton Shestakov
c68e50dfa3 rpms: add hgext3rd to mercurial.spec
Otherwise build process fails with somethings like this:


RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/lib64/python2.7/site-packages/hgext3rd/__init__.py
   /usr/lib64/python2.7/site-packages/hgext3rd/__init__.pyc
   /usr/lib64/python2.7/site-packages/hgext3rd/__init__.pyo
make: *** [docker-fedora20] Error 1
2016-03-23 11:53:11 +08:00
Jun Wu
7779785093 chg: allows default hg path to be overridden
Before this patch, chg will fall back to "hg" if neither CHGHG nor HG are set.
This may have trouble if the "hg" in PATH is not compatible with chg, which
can happen, for example, an old hg is installed in a virtualenv.

Since it's very hard to do a quick hg version check from chg, after discussion
in IRC with smf and marmoute, the quickest solution is to build a package with
a hardcoded absolute hg path in chg. This patch makes it possible by adding a
C macro HGPATH.
2016-03-20 15:43:20 -07:00
Jun Wu
fa8cfab3d2 chg: define PRINTF_FORMAT_ for non gnu C compiler
Before this patch, if __GNUC__ is not defined, PRINTF_FORMAT_ will not be
defined and will cause compilation error.

This patch solves the issue by making sure PRINTF_FORMAT_ is defined. It
allows chg to be compiled with tcc (http://bellard.org/tcc/) by:

  tcc -o chg *.c
2016-03-20 15:25:25 -07:00
Augie Fackler
98d0d11b3c check-code: also ban strcat
We're not using it now, so it's easy to ban.
2016-03-19 20:49:02 -04:00
Augie Fackler
c34901f108 check-code: prevent use of strcpy 2016-03-19 20:18:38 -04:00
Gregory Szorc
671d581fbd tests: try to import modules with Python 3
All of mercurial.* is now using absolute_import. Most of
mercurial.* is able to ast parse with Python 3. The next big
hurdle is being able to import modules using Python 3.

This patch adds testing of hgext.* and mercurial.* module imports
in Python 3. As the new test output shows, most modules can't
import under Python 3. However, many of the failures are due
to a common problem in a highly imported module (e.g. the bytes vs
str issue in node.py).
2016-03-12 14:05:23 -08:00
Gregory Szorc
06a84c707a tests: perform an ast parse with Python 3
Previously, test-check-py3-compat.t parsed Python files with Python 2
and looked for known patterns that are incompatible with Python 3.

Now that we have a mechanism for invoking Python 3 interpreters from
tests, we can expand check-py3-compat.py and its corresponding .t
test to perform an additional AST parse using Python 3.

As the test output shows, we identify a number of new parse failures
on Python 3. There are some redundant warnings for missing parentheses
for the print function. Given the recent influx of patches around
fixing these, the redundancy shouldn't last for too long.
2016-03-18 16:15:12 -07:00
Pulkit Goyal
4650b402b2 contrib: revsetbenchmarks use absolute_import and print_function 2016-03-16 04:35:03 +05:30
Pulkit Goyal
ec9a9da094 contrib: synthrepo use absolute_import 2016-03-16 04:23:58 +05:30
Pulkit Goyal
5cf3296f5c contrib: python-hook-examples use absolute_import 2016-03-16 04:13:28 +05:30
Pulkit Goyal
17d5faaa79 contrib: make perf.py use absolute_import 2016-03-16 04:12:16 +05:30
Jun Wu
9a62943b10 chg: do not redirect stdout to /dev/null
Redirecting stdout to /dev/null has unwanted side effects, namely ui.write
will stop working. This patch removes the redirection code and helps chg to
pass test-bad-extension.t.
2016-03-14 15:05:25 +00:00
Jun Wu
f94ba7eabd chg: downgrade "failed to read channel" from abortmsg to debugmsg
If the server has an uncaught exception, it will exit without being able to
write the channel information. In this case, the client is likely to complain
about "failed to read channel", which looks inconsistent with original hg.
This patch silences the error message and makes uncaught exception behavior
more like original hg. It will help chg to pass test-fileset.t.
2016-03-14 23:28:14 +00:00
Jun Wu
80fd75af3b chgserver: add an explicit "reconnect" instruction to validate
In some rare cases (next patch), we may want validate to do "unlink" without
forcing the client reconnect. This patch addes a new "reconnect" instruction
and makes "unlink" not to reconnect by default.
2016-03-14 13:48:33 +00:00
Gregory Szorc
891be7d008 help: document requirements
We didn't have unified documentation of the various repository
requirements. This patch changes that.
2016-03-12 18:51:07 -08:00
Pulkit Goyal
37b8e88ad9 showstack: use absolute_import 2016-03-13 01:59:18 +05:30
Pulkit Goyal
edde19dc54 contrib: use absolute_import in win32/hgwebdir_wsgi.py 2016-03-14 14:12:13 +05:30
Jun Wu
3303b6aab4 chgserver: handle ParseError during validate
Currently the validate command in chgserver expects config can be loaded
without issues but the config can be broken and chg will print a stacktrace
instead of the parsing error, if a chg server is already running.

This patch adds a handler for ParseError in validate and a new instruction
"exit" to make the client exit without abortmsg. A test is also added to make
sure it will behave as expected.
2016-03-14 12:52:35 +00:00
Yuya Nishihara
f65fcd1944 chg: provide early exception to user
See the previous patch for details. Since the socket will be closed by the
server, handleresponse() will never return:

  Traceback (most recent call last):
    ...
  chg: abort: failed to read channel
2016-03-12 22:17:30 +09:00
Pulkit Goyal
dd1cc9fd24 contrib: make memory.py use absolute_import 2016-03-13 01:32:42 +05:30
Pulkit Goyal
590ab61e6f check-code: use absolute_import and print_function 2016-03-13 01:08:39 +05:30
Jun Wu
e46af71471 chg: silently inherit server exit code
If chgserver aborts during startup, for example, error.ParseError when parsing
a config file, chg client probably just wants to exit with a same exit code
without printing other unrelated text. This patch changes the text "cmdserver
exited with status" from abortmsg to debugmsg and exits with a same exit code.
2016-03-11 02:52:06 +00:00
Pulkit Goyal
6eac74ace4 debugshell: use absolute_import 2016-03-06 03:19:08 +05:30
Yuya Nishihara
ef5269e2e1 test: make check-py3-compat.py ignore empty code more reliably
It couldn't exclude an empty file containing comments. That's why
hgext/__init__.py had been listed in test-check-py3-compat.t before
"hgext: officially turn 'hgext' into a namespace package".
2016-03-11 10:26:58 +09:00
Anton Shestakov
78963e34c6 dockerdeb: add Ubuntu Trusty
One problem reported by lintian is "bad-distribution-in-changes-file unstable"
in changelog, but the current changelog for the official package in Ubuntu also
uses that distribution name (unstable), because they import from Debian. This
certainly doesn't stop the build process.
2016-03-10 23:46:19 +08:00
Jun Wu
10d32ae3a0 chg: do not write pidfile
Current pidfile logic will only keep the pid of the newest server, which is
not very useful if we want to kill all servers, and will become outdated if
the server auto exits after being idle for too long.

Besides, the server-side pidfile writing logic runs before chgserver gets
confighash so it's not trivial to append confighash to pidfile basename like
we did for socket file.

This patch removes --pidfile from the command starting chgserver and switches
to an alternative way (unlink socket file) to stop the server.
2016-03-10 00:19:55 +00:00
Jun Wu
bac9bcbc56 chg: remove manual reload logic
chgserver now validates and reloads configs automatically. Manually reloading
is no longer necessary. Besides, we are deprecating pid files since the server
will periodically check its ownership of the socket file and exit if it does
not own the socket file any longer, which works more reliable than a pid file.
This patch removes the SIGHUP reload logic from both chg server and client.
2016-03-10 00:12:33 +00:00
Jun Wu
c1d58463c7 chg: use --daemon-postexec chdir:/ instead of --cwd /
The chgserver is designed to load repo config from current directory. "--cwd /"
will prevent chgserver from loading repo config and generate a wrong
confighash, which will result in a redirect loop. This patch removes "--cwd /"
and uses "--daemon-postexec chdir:/" instead.
2016-03-09 01:20:57 +00:00
Gregory Szorc
443b14a872 contrib: remove references to 2to3
The custom porting fixers are removed. A comment related to 2to3
has been removed from the import checker.

After this patch, no references to 2to3 remain.
2016-02-27 21:15:16 -08:00
Gregory Szorc
3e662313cc check-code: remove redundant import style check
We have a dedicated tool that checks for import conventions. Remove
a redundant and less powerful check.
2016-02-27 21:14:17 -08:00
Jun Wu
5ce2fd3a4b chg: limit reconnect attempts
Some users may have hg as a wrapper script which sets sensitive environment
variables (like setting up virtualenv). This will make chg redirect forever
because the environment variables are never considered up to date.
This patch adds a limit (10) for reconnect attempts and warn the user with
a possible solution if the limit is exceeded.
2016-03-02 10:42:58 +00:00
Jun Wu
7f85e71c20 chg: use validate to make sure the server is up to date
This patch uses the newly added validate method to make sure the server has
loaded the up-to-date config and extensions. If the server cannot validate
itself, the client will receive instructions and follow them to try to reach
another server that is more likely to validate itself. The instructions can
be a redirect (connect to another server address) and/or an unlink (stops an
out-dated server).
2016-03-06 14:22:37 +00:00
Jun Wu
4d98436906 chg: implement validate in hgclient
This patch implements the corresponding validate method in hgclient.
It will return instruction strings as is without taking any real action.
2016-03-06 14:21:52 +00:00
Pulkit Goyal
bc36832277 hgclient: use absolute_import and print_function 2016-03-06 03:15:45 +05:30
Pulkit Goyal
df7262ef1e fixpax: use absolute_import and print_function 2016-03-06 03:10:17 +05:30
Pulkit Goyal
2f8a8e257d debugcmdserver: use absolute_import and print_function 2016-03-06 03:06:09 +05:30
Pulkit Goyal
72963156f8 check-config: use absolute_import and print_function 2016-03-06 03:01:46 +05:30
Pulkit Goyal
7790f458a6 casesmash: use absolute_import 2016-03-06 02:25:50 +05:30
timeless
b31d4af380 import-checker: report local with stdlib late warning
Without this, developers have to figure it out on their own
2016-03-02 15:38:54 +00:00
Jun Wu
677d0dce4e chg: drop progress.assume-tty config
It was necessary to go through progress.uisetup() to set up the progressui
wrapper. Since the progress extension has got into the core, progress.assume-tty
is no longer necessary.
2016-02-29 11:43:25 +00:00
Jun Wu
93e167796f chg: detect chg started by chg
Sometimes people may create a symbol link from hg to chg, or write a wrapper
script named hg calling chg. Without $HG and $CHGHG set, this will lead to
chg executes itself causing deadlock. The user will notice chg hangs for some
time and aborts with a timed out message, without knowing the root cause and
how to solve it.

This patch sets a dummy environment variable before executing hg to detect
this situation, and print a fatal message with some possible solutions.

CHGINTERNALMARK is set by chg client to detect the situation that chg is
started by chg. It is temporary and should be dropped to avoid possible
side effects.
2016-02-26 14:13:12 +00:00
Jun Wu
2aca7b6e3b chg: fallback to original hg for some unsupported commands or flags
There are some known unsupported commands or flags for chg, such as hg serve -d
and hg foo --time. This patch detects these situations and transparently fall
back to the original hg. So the users won't bother remembering what chg can and
cannot do by themselves.

The current detection is not 100% accurate since we do not have an equivalent
command line parser in C. But it tries not to cause false positives that
prevents people from using chg for legit cases. In the future we may want to
implement a more accurate "unsupported" check server-side.
2016-02-26 14:17:59 +00:00
Jun Wu
c679d7cde1 chg: extract gethgcmd logic to a function
gethgcmd is to get original hg (not chg) binary name. This patch extracts
the logic from execcmdserver to make it available for the following patch.
2016-02-24 14:24:00 +00:00
Jun Wu
b3225df58f check-code: allow old style class with special comments
The following chgserver change will use an old style class to comply with
SocketServer's code style. This patch made it possible to pass check-code.
2016-02-24 18:42:14 +00:00
Jun Wu
8fd39d304f chg: hold a lock file before connected to server
This is a part of the one server per config series. In multiple-server setup,
multiple clients may try to start different servers (on demand) at the same
time. The old lock will not guarantee a client to connect to the server it
just started, and is not crash friendly.

This patch addressed above issues by using flock and does not release the lock
until the client actually connects to the server or times out.
2016-02-16 11:08:52 +00:00
Jun Wu
f5397047b4 serve: rename --daemon-pipefds to --daemon-postexec (BC)
Initially we use --daemon-pipefds to pass file descriptors for synchronization.
Later, in order to support Windows, --daemon-pipefds is changed to accept a
file path to unlink instead. The name is outdated since then.

chg client is designed to use flock, which will be held before starting a
server and until the client actually connects to the server it started. The
unlink synchronization approach is not so helpful in this case.

To address the issues, this patch renames pipefds to postexec and the following
patch will allow the value of --daemon-postexec to be things like
'unlink:/path/to/file' or 'none'.
2016-02-22 16:59:08 +00:00
Sune Foldager
5da16ec447 hgwebdir_wsgi: update script and expand help
I've updated the script to reflect changes in Mercurial and to include a much
more through installation guide with configuration examples and details on how
to configure IIS. I've used the script to set up a working server from scratch.
2016-02-19 17:50:28 +01:00
Jun Wu
9b4b8246df chg: pass sensitive command line flags to server
We are going to make chgserver load repo config, remember what it is, and
load repo config again to detect config change. This is the first step that
passes config, repo, cwd options to server. Traceback is passed as well to
cover errors before hitting chgserver.runcommand.
2016-02-17 15:00:47 +00:00
Jun Wu
b5898933a2 chg: use mallocx and reallocx in hgclient
This patch simplifies the code a bit, and reduces the binary size a little.
2016-02-17 15:08:09 +00:00
Jun Wu
a5c55dc9e7 chg: add utility functions mallocx, reallocx
They are like malloc and realloc but will abort the program on error.
A lot of places use {m,re}alloc and check their results. This patch
can simplify them.
2016-02-17 14:51:38 +00:00
Jun Wu
4da8e59d38 chg: forward umask from client to server
This is necessary to make chg test pass on test-inherit-mode.t.
2016-02-15 14:35:26 +00:00
Yuya Nishihara
cf8afe35a3 chg: forward job control signals to worker process (issue5051)
This is necessary to suspend/resume long pulls, interactive curses session,
etc.

The implementation is based on emacsclient, but our version doesn't test if
chg process is foreground or not before propagating SIGCONT. This is because
chg isn't always an interactive session. If we copy the SIGTTIN/SIGTTOU
emulation from emacsclient, non-interactive session can't be moved to a
background job.

  $ chg pull
  ^Z
  suspended
  $ bg %1
  [1] continued
  [1] suspended (tty input)  # wrong

https://github.com/emacs-mirror/emacs/blob/0e96320/lib-src/emacsclient.c#L1094
2016-01-19 22:31:59 +09:00
Yuya Nishihara
31584a86d7 chg: verify return value of sigaction() and sigemptyset()
They should never fail, but it couldn't hurt to be a paranoid.
2016-01-29 22:52:16 +09:00
Yuya Nishihara
f80facd9d0 chg: initialize sigaction fields more reliably
It seems calling memset() and sigemptyset() is common pattern to initialize
sigaction. And strictly speaking, sigset_t must be initialized by sigemptyset()
or sigfillset(). I saw git and uwsgi do that way, so let's follow them.
2016-01-29 22:42:22 +09:00
Durham Goode
e072959d9e revsetbenchmark: handle exception case
If the revset being benchmarked has an exception, the handling code was
encountering an error because the exception did not always have an "output"
attribute (I think it's a python 2.7 thing).
2016-02-10 12:39:25 -08:00
Yuya Nishihara
53de7956c0 chg: use in-tree hg executable to start server for testing 2016-01-03 12:45:32 +09:00
Yuya Nishihara
58036583d5 chg: import frontend sources
These files are copied from
https://bitbucket.org/yuja/chg/ -r f897faa79687
2016-01-03 12:39:27 +09:00
FUJIWARA Katsunori
5e089ee084 check-code: add rule to detect usage of external diff via extdiff
This rule detects "hg extdiff" invocation without -p/--program and
-o/--option.

This patch specifies "-p diff" explicitly in test-extdiff.t to avoid
false positive matching.
2016-02-11 02:15:45 +09:00
FUJIWARA Katsunori
34295148ed check-code: examine magic pattern matching against contents of a file
Before this patch, check-code examines "magic" pattern (e.g.
'^#!.*python') matching against not contents of a file, but name of
it.

This unintentionally omits code checking against Python source file,
of which filename doesn't end with "*.py" or "*.cgi", even though
contents of it starts with "#!/bin/python" or so.

In this change, 'pre' refers contents of file 'f'.
2016-02-10 22:44:29 +09:00
FUJIWARA Katsunori
0e48f36a63 misc: use modern exception syntax
This is fixing for 'legacy exception syntax; use "as" instead of ","'
check-code rule.

check-code has overlooked these, because files aren't recognized as
one to be checked (this problem is fixed by subsequent patch).
2016-02-10 22:44:29 +09:00
FUJIWARA Katsunori
05a600c8af hg-ssh: parenthesize non-translated message
This is fixing for 'missing _() in ui message (use () to hide
false-positives)' 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:28 +09:00
FUJIWARA Katsunori
ae585f8a5f check-commit: omit whitespace
This is fixing for 'no whitespace around = for named parameters'
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:28 +09:00
FUJIWARA Katsunori
41a375be1e check-commit: wrap too long line
This is fixing for 'line too long' 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:28 +09:00
FUJIWARA Katsunori
bdf197db2e tests: make chunk header of external diff glob-ed for portability
Before this patch, some tests using external "diff" command via
extdiff extension fail on Solaris, because system standard "diff" (=
/usr/bin/diff) on Solaris always formats chunk header in the style
below:

  @@ -X.x +Y.y @@

even though "diff" on Linux sometimes omits ".x" and/or ".y" in it.

This patch makes chunk header of external diff glob-ed for portability
of tests, and adds check-code.py rules to detect such diff output in
tests.

This patch also changes "hg diff" output in test-subrepo-git to
simplify detection rules, even though it is certainly portable because
these lines are generated by "git" command.

This patch is a part of making tests using external "diff" portable,
and tests below aren't yet portable even after this patch.

  test-largefiles-update.t
  test-subrepo-deep-nested-change.t
2016-02-08 18:29:17 +09:00
FUJIWARA Katsunori
4d0ebd5133 tests: make timezone in diff output glob-ed for portability
Before this patch, some tests using external "diff" command via
extdiff extension fail on Solaris, because system standard "diff" (=
/usr/bin/diff) on Solaris doesn't display timezone for timestamp of
each files in diff output.

This patch makes timezone in external diff output glob-ed for
portability of tests, and adds check-code.py a rule to detect such
2016-02-08 18:29:17 +09:00
FUJIWARA Katsunori
91b31cc00a tests: omit -p for external diff via extdiff extension for portability
Before this patch, some tests using external "diff" command via
extdiff extension fail on Solaris, because "-p" (show which C function
each change is in) option isn't supported by system standard "diff" on
Solaris, even though extdiff passes it to external "diff" by default.

Fortunately, this non-portable option isn't important for (current, at
least) tests using external "diff" command via extdiff extension.

This patch omits "-p" for external "diff" command via extdiff
extension for portability of tests, and adds check-code.py a rule to
detect invocation of "diff" with "-p".

Newly added check-code.py rule examines only lines generated by
external "diff" with "-r", because strict examination might
misidentify "hg diff -p" or other complicated lines consisting of
"diff" string as wrong one.

This patch is a part of making tests using external "diff" portable,
and tests below aren't yet portable even after this patch.

  test-graft.t
  test-largefiles-update.t
  test-subrepo-deep-nested-change.t
2016-02-08 18:29:17 +09:00
Matt Mackall
9b78d1a779 check-commit: check for double-addition of blank lines
Previously, we were only checking for a blank line being added next to
an existing one. Now we also check for two being added at the same time.
2016-02-05 16:54:01 -06:00
Matt Mackall
925e4d9b93 check-commit: scan for multiple instances of error patterns 2016-02-05 16:52:02 -06:00
FUJIWARA Katsunori
c217cd84b3 tests: execute check-config.py without xargs
Before this patch, test-check-config.t fails on Solaris, because
"xargs" doesn't invoke check-config.py with all filenames at once.

"xargs" may invoke specified command multiple times with part of
arguments given from stdin: according to "xargs(1)" man page, this
dividing arguments is system-dependent.

For portability of test-check-config.t, this patch adds "xargs" like
mode to check-config.py and executes it in test-check-config.t without
"xargs".
2016-02-05 22:32:05 +09:00
Martin von Zweigbergk
2b4207d948 check-code: allow "grep pattern filename-containing-dash-a"
We're trying to forbid "grep -a" and unintentionally complained even
if the "-a" was part of the filename. Requiring a space before "-a" to
match is probably good enough.
2016-02-02 21:20:04 -08:00
timeless
7c2842e773 copyright: update to 2016 2016-01-21 21:15:52 +00:00
Mathias De Maré
53015f77fd buildrpm: use bash shebang, since we use bash features in the script
As suggested by Bryan O'Sullivan.
2016-01-15 16:16:25 +01:00
Bryan O'Sullivan
9c88af7c39 with: use context manager for file I/O in memusage 2016-01-15 13:14:45 -08:00
timeless
1af8764a9d check-code: export needs a space to avoid false positives 2016-01-12 15:58:59 +00:00
Mathias De Maré
04fc554bf2 buildrpm: move creation of RPM directories from dockerrpm
Handling the creation of the RPM directories in buildrpm
is more consistent and takes care of non-docker builds as well.
2016-01-07 06:44:37 +01:00
timeless
6128260f9d check-commit: sort errors by line number 2016-01-12 08:34:38 +00:00
timeless
f4c0ab7d00 check-commit: try to fix multiline handling
The old code did not understand the difference between the first line of the summary,
and a random line in the summary that happened to include a #, or a
random line in the changes that happened to include it.

7c3798ffdc0c is an example where it fails
2016-01-12 08:50:15 +00:00
timeless
c4f6fb8fc2 check-commit: support REVs as commandline arguments
usage:
* HG_NODE=REV check-commit
* hg export REV | check-commit
* check-commit REV ...
2016-01-07 01:28:59 +00:00
timeless
971508cd4e check-commit: modularize 2016-01-07 00:55:45 +00:00
timeless
149f294053 check-commit: fix summary length regexp 2016-01-07 03:58:40 +00:00
Gregory Szorc
ddc771a1b2 debugshell: disable demand importer when importing debugger
For reasons I can't explain (but likely have something to do with a
combination of __import__ inferring default values for arguments and
the demand importer mechanism further assuming defaults), the demand
importer isn't playing well with IPython. Without this patch, we get
a failure "ValueError: Attempted relative import in non-package" when
attempting to import "IPython." The stack has numerous demandimport
calls on it and adding "IPython" to the exclude list in demandimport
isn't enough to make the problem go away, which means the issue is
likely somewhere in the bowells of IPython. It's easier to just disable
the demand importer when importing the debugger.
2016-01-11 18:16:38 -08:00
Matt Mackall
3ace626aa9 check-code: allow only-whitespace lines in tests
These turn out to be necessary to embed diffs with blank lines in test
input. So we now complain about whitespace following a character.
2016-01-08 12:35:02 -06:00
Matt Mackall
9b87c36795 check-commit: try to curb bad commit summary keywords
The goal of commit summary keywords is to help us sort, categorize,
and filter our voluminous commits for our release notes in a way
that's helpful and meaningful to end users. Lately, there have been a
huge number of "keywords" that are neither words nor particularly key.

This patch tries to discourage that by narrowing the allowed
characters to alphanumeric. In particular, it doesn't allow "."
(method, function names, and file extensions) and "/" (filenames). It
also gives a short reminder of what a keyword ought to be.
2015-12-10 12:56:23 -06:00
Urs Rau
e104ebf4e7 installer: add windows application version number to inno installer script
This addition to the inno installer script means that the windows uninstaller
registry key “DisplayVersion" is set to the application version number and
will show in Add/Remove Programs.
2016-01-07 12:49:26 +00:00
Matt Harbison
59bfa8869d wix: add help for current internal topics
This makes the changes in 68b7b759ebff and 71a3703364df available on Windows.

I'm not setup to make the installer, so someone with experience in this area
should probably give it a look.  In looking around to try to figure out how to
build the installer, it looks like the Makefile may need an update to $DOCFILES.
2015-12-17 21:24:08 -05:00
Matt Mackall
82e0719648 merge with stable 2016-01-07 17:51:54 -06:00
Mathias De Maré
efbe4fff46 dockerrpm: fix CentOS 5 RPMs (issue4977)
The older rpmbuild in CentOS 5 fails if some of the output directories
have not been created yet. This change results in creating those directories.
2016-01-04 21:21:59 +01:00
Mathias De Maré
148961a2eb dockerlib: short form for non-unique uid/gid for CentOS 5 compat (issue4977)
CentOS 5 does not support '--non-unique', but does support the short '-o'.
2015-12-07 17:39:31 +01:00
Pierre-Yves David
888da26260 docker: match more version of 'hg docker version' (issue4967)
My version of docker (1.8.3) have a different formating for 'docker version'
that broke the build script. We make the version matching more generic in to
work with both version.
2015-11-24 18:13:25 -08:00
Gregory Szorc
f5985dcd63 revlog: return offset from _chunkraw()
A subsequent patch will refactor _chunks() and the calculation of the
offset will no longer occur in that function. Prepare by returning the
offset from _chunkraw().
2016-01-05 19:51:51 -08:00
timeless
b863202251 check-code: enforce strict spacing around assignment 2015-12-31 17:41:59 +00:00
timeless
ebb1d48658 cleanup: remove superfluous space after space after equals (python) 2015-12-31 08:16:59 +00:00
Yuya Nishihara
79f9ed4511 import-checker: list package directory as stdlib module
Before this patch, a directory containing __init__.py wasn't counted as a
module and __init__.pyc was listed as foo.bar.__init__ module.
2015-12-27 23:37:14 +09:00
Yuya Nishihara
40d0bc65ac import-checker: normalize directory separator to get module name on Windows
It didn't work if a path contains "\\". Therefore, ctypes.util couldn't be
found on Windows.
2015-12-27 23:48:19 +09:00
Anton Shestakov
169417da80 dockerlib: allow non-unique uid and gid of $DBUILDUSER (issue4657)
There are make targets for building mercurial packages for various
distributions using docker. One of the preparation steps before building is to
create inside the docker image a user with the same uid/gid as the current user
on the host system, so that the resulting files have appropriate
ownership/permissions.

It's possible to run `make docker-<distro>` as a user with uid or gid that is
already present in a vanilla docker container of that distibution. For example,
issue4657 is about failing to build fedora packages as a user with uid=999 and
gid=999 because these ids are already used in fedora, and groupadd fails.
useradd would fail too, if the flow ever got to it (and there was a user with
such uid already).

A straightforward (maybe too much) way to fix this is to allow non-unique uid
and gid for the new user and group that get created inside the image. I'm not
sure of the implications of this, but marmoute encouraged me to try and send
this patch for stable.
2015-11-08 01:10:52 +08:00
Steve Borho
e04f287b5a wix: style-coal.css has been renamed 2015-11-09 09:41:20 -06:00
Augie Fackler
75a732a6ac packaging: rework version detection and declaration (issue4912)
Previously the -rc in our rc tags got dropped, meaning that those
packages looked newer to the packaging system than the later release
build. This rectifies the issue, though some damage may already have
been done on 3.6-rc builds.

I'm mostly cargo-culting the RPM version format - there don't appear
to be rules for RPM about how to handle this. Hopefully an RPM
enthusiast can fix up what I've done as a followup.
2015-10-26 14:19:37 -04:00
timeless
f10778ca64 check-code: allow argument passing py2.6ism
this backs out dead48a12ce0, because Python2.5 support was dropped
2015-10-15 17:28:26 -04:00
timeless
ed8b59f668 win32: drop reference to python2.5 2015-10-15 17:19:11 -04:00
Ryan McElroy
20c45a5f3d editmerge: dequote other use of $ED
We want to support editors with parameters, eg EDITOR="vim -O" or whatever.
So remove the quotes from around $ED and assume that the editor variable is
properly escaped already.
2015-10-19 21:36:12 -07:00
Mads Kiilerich
09567db49a spelling: trivial spell checking 2015-10-17 00:58:46 +02:00
timeless
76f10d8d74 check-code: block non-portable pipe-and 2015-10-15 20:36:12 -04:00
Ryan McElroy
ea5dcaa5fa editmerge: properly quote variables
Previously, files with spaces would break editmerge.
2015-10-17 15:48:14 -07:00
FUJIWARA Katsunori
106983607a dirstate: make dirstate.write() callers pass transaction object to it
Now, 'dirstate.write(tr)' delays writing in-memory changes out, if a
transaction is running.

This may cause treating this revision as "the first bad one" at
bisecting in some cases using external hook process inside transaction
scope, because some external hooks and editor process are still
invoked without HG_PENDING and pending changes aren't visible to them.

'dirstate.write()' callers below in localrepo.py explicitly use 'None'
as 'tr', because they can assume that no transaction is running:

  - just before starting transaction
  - at closing transaction, or
  - at unlocking wlock
2015-10-17 01:15:34 +09:00
Christian Delahousse
c021a178a2 contrib: make editmerge look for merge markers at the beginning of the line
This fix adds a caret to the start of the regex looking for merge markers. This
avoids the issue arises when you've real merge conflicts in a file that tests
for the existance of merge markers in test output. Editmerge will not open on
the fake/tested merge markers because they'll be indented in.
2015-10-16 15:01:42 -07:00
Laurent Charignon
ffd341931d dirstate: add test for non-normal set consistency
This adds a test extension to check that the non-normal set contains the
expected entries. It wraps several methods of the dirstate to check that
the non-normal set has the correct values before and after the call. The
extension lives in contrib so that paranoid developers can easily
enable it to make sure that the non-normal set is consistent across more
complex operations than the included tests.
2015-12-21 16:26:44 -08:00
timeless
8dd6ee4d9a check-code: improve test-check-code error diffs
Whenever check-code finds something wrong, the diffs it
generated were fairly hard to read.

The problem is that check-code before this change
would list files that were white listed using
no- check- code but without a glob marker.

Whereas, the test-check-code.t expected output has
no-che?k-code (glob) in order to avoid having itself
flagged as a file to skip.

Thus, in addition to any lines relating to things you
did wrong, all of the white-listed files are listed as
changed.

There is no reason for things to be this painful.

This change makes the output from check-code.py match
the expected output in test-check-code.t
2015-12-24 19:32:14 +00:00
Danek Duvall
7653e06efa tests: Solaris diff -U also emits "No differences encountered"
This came up before, but the tests in check-code.py don't find -U (only -u)
and they don't work when the diff is inside a shell function.  This fixes
the offending tests and beefs up check-code.py.
2015-12-27 15:24:48 -08:00
Bryan O'Sullivan
7cd156ddd3 perf: close transaction in perffncachewrite
This fixes a bug, and brings CPython behaviour on this test into
line with PyPy.
2015-12-27 23:55:54 +09:00
Gregory Szorc
02bc128123 import-checker: force 'logging' to stdlib module
Not sure why this isn't getting picked up. Perhaps we're not handling
stdlib paths that have sub-modules? Something to investigate for another
day...
2015-12-23 12:27:24 -08:00
Matt Harbison
0cdbeb7bf0 import-checker: force 'ctype.util' to stdlib module
Not having this caused warnings on Windows:

  mercurial/pure/osutil.py:12: stdlib import follows local import: os
  mercurial/pure/osutil.py:13: stdlib import follows local import: socket
  mercurial/pure/osutil.py:14: stdlib import follows local import: stat
  mercurial/pure/osutil.py:15: stdlib import follows local import: sys
2015-12-22 21:47:40 -05:00
timeless
5f0b7179f1 mercurial.spec: remove execute bit 2015-12-22 10:58:47 +00:00
timeless
06572aab33 contrib: add execute bit for fixpax.py 2015-12-22 07:58:44 +00:00
timeless
f8d658c413 contrib: add execute bit for check-py3-compat.py 2015-12-22 07:58:21 +00:00
Gregory Szorc
517d3d4815 perf: make start revision configurable for perfrevlog
This will help isolate performance characteristics of delta chains.
2015-12-20 19:56:23 -08:00
Gregory Szorc
e8cdc56137 perf: use standard arguments for perfrevlog
We have a convention of using -c|-m|FILE elsewhere for reading from
revlogs. Use it for `hg perfrevlog`.

While I was here, I also added a docstring to document what this
command does, as "perfrevlog" is ambiguous.
2015-12-20 19:45:55 -08:00
Matt Mackall
a8248afde0 cleanup: back out performance hacks amended into previous commit 2015-12-21 14:52:18 -06:00
timeless
777dbfe303 commands: consistently indent notes 3 spaces
most notes have 3 spaces for indentation, these had 2...
2015-12-18 06:33:48 +00:00
Gregory Szorc
9f75546b76 perf: add perfrevlogrevision
As part of investigating performance improvements to revlog reading,
I needed a mechanism to measure every part of revlog reading so I knew
where time was spent and how effective optimizations were.

This patch implements a perf command for benchmarking the various
stages of reading a single revlog revision.

When executed against a manifest revision at the end of a 30,000+
long delta chain in mozilla-central, the command demonstrates that
~80% of time is spent in zlib decompression.
2015-12-20 18:38:21 -08:00
Gregory Szorc
179b25b04a perf: call clearcaches() in perfmanifest
The old code only partially cleared the caches. Now that we have a
comprehensive method for wiping all caches, let's call it.

This appears to introduce a marginal regression in `hg perfmanifest`
on mozilla-central. This is good because the new result is more
accurate since caches aren't being used.
2015-12-20 17:57:44 -08:00
Pascal Quantin
edc138619b win32: add internals help topics to Inno Setup installer 2015-12-17 19:33:44 +01:00