Commit Graph

2014 Commits

Author SHA1 Message Date
Yuya Nishihara
f412c69557 dispatch: move initialization of sys.std* files
I'll add another Python 3 hack.
2017-10-02 07:18:24 +01:00
Yuya Nishihara
bac3fece2c chg: just forward --time to command server
Since we've removed the use of atexit in ee4f321cd621, --time just works.
2017-10-07 22:07:10 +09:00
Saurabh Singh
bacb1366fc test-check-code: fail new commits which use 'atexit' instead of 'ui.atexit'
Callbacks registered with 'atexit' are sometimes not called (like when
hg aborts and calls os._exit). On the other hand, callbacks registered with
'ui.atexit' are called in most cases. Therefore, encouraging the use of
'ui.atexit' by failing the test 'test-check-code.t' appropriately.

Test Plan:
Ran the test 'test-check-code.t' after importing 'atexit' in one of
the py files and confirmed that the test fails.

Differential Revision: https://phab.mercurial-scm.org/D961
2017-10-05 14:18:55 -07:00
Boris Feld
43de0b805b configitems: register the 'perf.stub' config 2017-06-30 03:43:46 +02:00
Siddharth Agarwal
3a77727405 check-code: allow an exception for camelcase where required
unittest has a `maxDiff` parameter which has to be set to `None` in order for
large enough failure diffs to be displayed. Add a comment to disable the
camelcase check for `self.maxDiff = None` lines.

Differential Revision: https://phab.mercurial-scm.org/D895
2017-10-02 02:34:47 -07:00
muxator
a9aa7ba9de docker: try to follow the best practices for writing Dockerfiles
Merged multiple RUN instructions and sorted the arguments alphabetically
Reference: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
2017-10-01 01:02:22 +02:00
Kyle Lippincott
ad7885baee deb: build and install chg
Differential Revision: https://phab.mercurial-scm.org/D883
2017-10-01 03:31:32 -07:00
Kyle Lippincott
c371483a5d deb: install zsh completions to /usr/share/zsh/vendor-completions
This location is used by debian (and ubuntu) to store completions provided by
other deb packages.  The default fpath appears to have this before any of the
zsh-provided instances of the completions, so this should take precedence.

Differential Revision: https://phab.mercurial-scm.org/D882
2017-10-01 02:53:10 -07:00
Siddharth Agarwal
4247de0b07 tests: disable lints on mercurial/thirdparty
In the next patch, this directory will be used to vendor in some third-party
code.

Differential Revision: https://phab.mercurial-scm.org/D866
2017-10-01 03:24:19 -07:00
Augie Fackler
074e849cb3 contrib: add a check to check-code to ban superfluous pass statements
These have annoyed me for a long time, and I'm tired of commenting on
them in reviews. I'm sorry for how complicated the regular expression
is, but I was too lazy to go crack open pylint's code and add the
check there.
2017-09-29 11:55:44 -04:00
Pulkit Goyal
44abcb14f6 py3: whitelist 15 more tests passing on Python 3
We have reached the count of 75 tests passing on Python 3.

Differential Revision: https://phab.mercurial-scm.org/D858
2017-09-30 18:19:14 +05:30
Martin von Zweigbergk
38828a858a dirstate: use keyword arguments to clarify walk()'s callers
The arguments are especially non-obvious because the order is
different from dirstate.status().

Differential Revision: https://phab.mercurial-scm.org/D846
2017-09-29 14:19:36 -07:00
Martin von Zweigbergk
a584384ee7 perf: remove fallbacks to ancient versions of dirstate.walk()
If the call to dirstate.walk() failed, we would try to fall back to
older versions. These were removed in 869e4a22ee0d (walk: remove
cmdutil.walk, 2008-05-12) and 4f67ccefb6ef (dirstate: fold statwalk
and walk, 2008-06-26). We don't care about testing performance of
versions that old versions at this point, so let's clean up.

Differential Revision: https://phab.mercurial-scm.org/D845
2017-09-29 14:23:41 -07:00
Jun Wu
a05655c958 chg: show timestamp with debug messages
Like `strace -tr`, this helps finding performance bottlenecks.

Differential Revision: https://phab.mercurial-scm.org/D807
2017-09-23 14:58:40 -07:00
Augie Fackler
2976b9ba7b python3: remove test-update-dest.t from the whitelist
I've poked at this on and off several times, and I can't figure out
what regressed. Let's kick this out of the whitelist for now so that
we can get the *rest* of our progress covered by the buildbots.
2017-09-18 15:34:50 -04:00
Augie Fackler
1bdc1915c7 python3: another 3 tests whitelisted 2017-09-16 11:33:16 -04:00
Martin von Zweigbergk
78fb62643c check-code: fix incorrect capitalization in camelcase regex
This was found internally at Google as part of a monorepo-wide
cleanup.

Differential Revision: https://phab.mercurial-scm.org/D637
2017-09-06 08:22:54 -07:00
Jun Wu
8909822786 phabricator: add a config to use curl for communication
Not sure why, but I got `phabsend` hang on work network pretty frequently.
The traceback indicates it hangs at `_sslobj.do_handshake()`:

  File "mercurial/sslutil.py", line 404, in wrapsocket
    sslsocket = sslcontext.wrap_socket(sock, server_hostname=serverhostname)
  File "/usr/lib/python2.7/ssl.py", line 363, in wrap_socket
    _context=self)
  File "/usr/lib/python2.7/ssl.py", line 611, in __init__
    self.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 840, in do_handshake
    self._sslobj.do_handshake()

I had tried adding `timeout` in various places but they seem not effective.
It seems easier to just allow shelling out to `curl` with retry and timeout
flags.

This could also be helpful for people with an older Python installed without
modern security (SNI).

Differential Revision: https://phab.mercurial-scm.org/D605
2017-09-01 12:13:17 -07:00
Jun Wu
70db4ce38e phabricator: standardize colors
Previously, the `--confirm` text could have colors but the main `phabsend`
does not. This patch adjusts the main command so it also has colors.
A default color table was added so the colors are visible by default.

Differential Revision: https://phab.mercurial-scm.org/D515
2017-08-24 18:00:23 -07:00
Jun Wu
ada59ccd75 check-code: forbid "\S" in egrep regular expression
BSD `egrep` does not like it. So let's forbid it.

Differential Revision: https://phab.mercurial-scm.org/D610
2017-09-01 16:44:30 -07:00
Jun Wu
e4fdb2e534 check-code: forbid using bash in shebang
Some platforms (ex. FreeBSD) do not have `bash` by default. Therefore it
should not be used in test scripts.

Differential Revision: https://phab.mercurial-scm.org/D609
2017-09-01 15:47:32 -07:00
Phil Cohen
28052d0586 context: add arbitraryfilectx, which can represent files outside the workdir
Move it from contrib/simplemerge so it can be re-used in the future.

Differential Revision: https://phab.mercurial-scm.org/D604
2017-09-01 11:52:20 -07:00
Phil Cohen
62cb8c7754 simplemerge: remove unused filtereddata parameter
Differential Revision: https://phab.mercurial-scm.org/D603
2017-09-01 10:35:43 -07:00
Jun Wu
56e365cc2f import-checker: allow relative import a module being checked
This would make the checker more friendly for 3rd-party code. For example,

In remotefilelog/x.py, it may have:

    from . import shallowutils

That could trigger "relative import of stdlib module" if
"remotefilelog" was installed in the system. If the module being checked
conflicts with the system module, it makes sense to not treat that module as
system module. This patch makes it so.

Differential Revision: https://phab.mercurial-scm.org/D552
2017-08-28 13:43:25 -07:00
Augie Fackler
e45ed2be45 python3: whitelist another 5 passing tests found with the ratchet script 2017-08-22 20:25:08 -04:00
Augie Fackler
48dbe73629 python3: replace sorted(<dict>.iterkeys()) with sorted(<dict>) 2017-08-22 20:06:58 -04:00
Augie Fackler
169f5af21b contrib: add test-check-module-imports.t to the Python 3 whitelist
This has the benefit of also catching most (if not all!) old-style
print statements and except statements.
2017-08-22 17:16:13 -04:00
Jun Wu
e80bc134f5 phabsend: show associated Differential Revisions with --confirm
Often people running `phabsend --confirm` just want to check whether a
commit will trigger a creation of new Differential Revision, or update an
existing one. This patch implements that. The `--confirm` message was
changed to use node instead of revision number to be consistent with what
`phabsend` outputs.

An example output looks like:

  D487 - a80f447973a0 test-extension: enable demandimport explicitly
  D494 - cf440ea6e47e test-casecollision-merge: fix the test
  NEW - 0a6b97147128 phabsend: polish the docstring a bit
  Send the above changes to https://phab.mercurial-scm.org/ (yn)?

Differential Revision: https://phab.mercurial-scm.org/D514
2017-08-24 17:44:08 -07:00
Jun Wu
6ce8fb7684 phabsend: print the actual URL with --confirm
Sometimes people have multiple Phabricator endpoints set in multiple repos.
It seems better for `--confirm` to prompt about the Phabricator endpoint
patches being sent to.

Differential Revision: https://phab.mercurial-scm.org/D513
2017-08-24 17:31:33 -07:00
Jun Wu
edfba89554 phabsend: detect patch change with larger context
Previously phabsend has an optimization that will skip uploading a diff if
the patch (with context line number = 1) remains unchanged. That could be
confusing:

  Aug 24 15:52:28 <martinvonz> phillco: something is wrong with phabricator'your patches/
  Aug 24 15:52:45 <martinvonz> ... with phabricator's view of your patches again
  Aug 24 15:53:38 <martinvonz> if i phabread D388 and then D399, i get a version of filemerge.py with "a, b, c" somewhere on line 344, which is not what phabricator shows for D399
  Aug 24 15:53:51 <martinvonz> junw: maybe that's more for you ^

Fix that by checking context with 32767 lines, which is the same as what
will be actually sent.

Differential Revision: https://phab.mercurial-scm.org/D512
2017-08-24 17:25:18 -07:00
Jun Wu
3969533711 phabsend: make --amend the default
The local tag feature was intended to make `phabsend` closer to `email`
workflow. But its experience is not great in multiple ways:

  - after rebase, obsoleted changesets are still visible because of tags
  - without obsstore, the association information will get lost
  - even with obsstore, things could go wrong with graft, export+import
  - no easy way to tell which Differential Revision a commit is associated

Therefore make `--amend` the default. People wanting the old behavior can
use `--no-amend`.

Differential Revision: https://phab.mercurial-scm.org/D511
2017-08-24 16:52:28 -07:00
Jun Wu
e2464e037c phabsend: polish the docstring a bit
Differential Revision: https://phab.mercurial-scm.org/D510
2017-08-24 17:26:10 -07:00
Yuya Nishihara
a22ffac20b encoding: add function to test if a str consists of ASCII characters
Most strings are ASCII. Let's optimize for it.

Using uint64_t is slightly faster than uint32_t on 64bit system, but there
isn't huge difference.
2017-04-23 12:59:42 +09:00
Augie Fackler
8db7f3946c contrib: make import-checker agree more with run-tests about heredocpy
run-tests.py and import-checker.py take wholly different approaches to
.t-tests, and the result was that they had different notions about
when a Python heredoc had ended, leading to conflicts. This resolves
part of the issue, and the rest I can deal with by tweaking the one
offending test file.
2017-08-22 16:37:06 -04:00
Augie Fackler
32bec6bdb1 contrib: add bzrlib to list of packages from which we import symbols
Helps some tests pass the import checker.
2017-08-22 15:28:54 -04:00
Augie Fackler
aad2b05113 contrib: allow symbol imports from hgclient for tests 2017-08-22 14:25:06 -04:00
Phil Cohen
8c03c90982 simplemerge: stop accepting, and passing, file parameters
Differential Revision: https://phab.mercurial-scm.org/D381
2017-08-24 21:30:51 -07:00
Phil Cohen
cf2a7b8d40 contrib: make simplemerge script pass context-like objects
`simplemerge()` will soon require context-like objects to work. Create a simple
context-like object that wraps the requested files and can be passed to the new
API.

Differential Revision: https://phab.mercurial-scm.org/D378
2017-08-24 21:30:37 -07:00
Augie Fackler
e5f807b019 contrib: always treat importlib.* as stdlib 2017-08-22 16:02:57 -04:00
Augie Fackler
455b926bc2 simplemerge: update to conform with modern import conventions 2017-08-22 14:13:13 -04:00
Augie Fackler
77ae4c9284 contrib: inform import checker that __builtin__ is a thing 2017-08-22 14:12:37 -04:00
Augie Fackler
ec8689fc6d contrib: allow importing "symbols" from mercurial 2017-08-22 14:12:21 -04:00
Augie Fackler
edacb19438 hgperf: update to conform with import style checks 2017-08-22 14:12:03 -04:00
Augie Fackler
3990642074 contrib: update hg-ssh to conform with import style checks 2017-08-22 14:11:48 -04:00
Augie Fackler
ed0ae6fd2e contrib: have import-checker work mostly with native strings for mod names
Module names are a bit awkward to deal with portably otherwise.
2017-08-22 12:59:21 -04:00
Augie Fackler
bfabad4e98 python3: whitelist test-imports-checker.t, which now passes 2017-08-22 11:00:46 -04:00
Augie Fackler
f7c4bd058e contrib: make import checker always think in terms of bytes
The doctests now do some regrettable things, but they'll always work
since we're dealing with ASCII module names etc.
2017-08-22 12:58:28 -04:00
Augie Fackler
4ece1bb8b2 contrib: work around some modules not existing on Py3 in import checker 2017-08-22 10:58:29 -04:00
Augie Fackler
4927f52889 undumprevlog: update to valid Python 3 syntax
I didn't do anything to ensure correctness here, just enough to avoid
tracebacks in the import checker, which uses the native ast module to
try and parse all our Python files.
2017-08-22 12:58:51 -04:00
Augie Fackler
837cc32717 python3: whitelist another *13* tests that now pass
Differential Revision: https://phab.mercurial-scm.org/D302
2017-07-27 00:00:15 -04:00