Commit Graph

34431 Commits

Author SHA1 Message Date
Matt Harbison
773c9a551d test-extdata: conditonalize error message for Windows 2017-10-14 00:20:59 -04:00
Matt Harbison
95f6e46463 test-audit-path: fill in missing output for no-symlink case
It looks like this was meant to go with bf9ade12e62e.
2017-10-14 00:07:26 -04:00
Yuya Nishihara
74b6f75047 test-i18n: guard gettext test appropriately 2017-10-14 13:37:14 +09:00
Boris Feld
00846dabc6 hook: add a 'hashook' function to test for hook existence
Preparing the data for some hooks can be expensive. Add a function to check if
a hook exists so we can skip useless preparation if no hook is configured.
2017-10-08 13:08:31 +02:00
muxator
66d556e57b build: for the bootstrap phase of a deb/rpm build pure-py mercurial is enough
When bootstrapping a deb/rpm build, packagelib.sh starts performing a local
build for the sole purpose of parsing the output of "hg version".
Then it "hg archive"s the source code, and builds everything again.

For that initial step, we are perfectly good in using a pure python mercurial,
without compiling the c modules (base85, bdiff, zstdlib, ...).

On my personal system, this cuts down 22 seconds for a package build (the
bootstrapping build goes from ~30 to ~8 seconds).
2017-10-13 22:42:17 +02:00
Phil Cohen
0d0a416a27 context: add a fast-comparision for arbitraryfilectx and workingfilectx
Differential Revision: https://phab.mercurial-scm.org/D1056
2017-10-13 12:40:05 -07:00
Denis Laxalde
6ff583b949 tersestatus: avoid modifying tersedict
Turn dirnode's methods into generators which can be used to update "tersedict"
in caller. So instead of passing the "tersedict" to be mutated here and there,
it's now clearer where it is updated as it's purely a local variable to
tersedir() function.

While I was here, I renamed _processtersestatus to tersewalk and
_addfilestotersed to iterfilepaths.

Differential Revision: https://phab.mercurial-scm.org/D1043
2017-10-13 04:02:06 +05:30
Denis Laxalde
e623051ee4 tersestatus: make methods part of the dirnode class
Differential Revision: https://phab.mercurial-scm.org/D1042
2017-10-11 21:19:19 +02:00
Pulkit Goyal
4b9eb4d057 tersestatus: re-implement the functionality to terse the status
The previous terse status implementation was hacking around os.listdir() and was
flaky. There have been a lot of instances of mercurial buildbots failing
and google's internal builds failing because of the
hacky implementation of terse status. Even though I wrote the last
implementation but it was hard for me to find the reason for the flake.

The new implementation can be slower than the old one but is clean and easy to
understand.

In this we create a node object for each directory and create a tree
like structure starting from the root of the working copy. While building the
tree like structure we store some information on the nodes which will be helpful
for deciding later whether we can terse the dir or not.
Once the whole tree is build we traverse and built the list of files for each
status with required tersing.

There is no behaviour change as the old test, test-status-terse.t passes with
the new implementation.

Differential Revision: https://phab.mercurial-scm.org/D985
2017-10-06 20:54:23 +05:30
Phil Cohen
b6042b5881 context: add is isinmemory() to filectx
This will make it easier to skip certain behavior when running an in-memory
merge.

Differential Revision: https://phab.mercurial-scm.org/D1061
2017-10-13 12:54:46 -07:00
Ryan McElroy
25aff2d866 merge: ensure that we always commit the mergestate
In future patches, we may halt the merge process based on configuration or
user requests by raising exceptions. We need to ensure that the mergestate
is unconditionally committed even when such an exception is raised.

Depends on D930.

Differential Revision: https://phab.mercurial-scm.org/D931
2017-10-06 06:48:43 -07:00
Ryan McElroy
81a06c93fe merge: add tests to show current behavior on failed filemerges
Currently, failed file merges will nevertheless force the user to continue
attempting to merge all additional unresolved files. Future patches will allow
the user to halt the merge process instead. This patch first introduces a test
demonstrating the current bejhavior so the upcoming changes are more obvious.

Differential Revision: https://phab.mercurial-scm.org/D930
2017-10-06 06:48:43 -07:00
Durham Goode
1d4b04170c dirstate: move the _dirfoldmap to dirstatemap
Now that dirstatemap is the source of truth for the list of directories, let's
move _dirfoldmap on to it.

This pattern of moving cached variables onto the dirstate map makes it easier to
invalidate them, as seen by how the cache invalidation functions are slowly
shrinking to just be recreating the dirstatemap instance.

Differential Revision: https://phab.mercurial-scm.org/D983
2017-10-05 11:34:41 -07:00
Durham Goode
e37fd6649b dirstate: remove _dirs property cache
Now that dirs is source of truthed on the dirstatemap, let's get rid of the
_dirs propertycache on the dirstate.

Differential Revision: https://phab.mercurial-scm.org/D982
2017-10-05 11:34:41 -07:00
Durham Goode
1b9b3caa47 dirstate: remove _filefoldmap property cache
Now that the filefoldmap is source of truthed on the dirstatemap, let's get rid
of the property cache on the dirstate.

Differential Revision: https://phab.mercurial-scm.org/D981
2017-10-05 11:34:41 -07:00
Durham Goode
28f48a6846 dirstate: move identity to dirstatemap
Moving the identity function to the dirstatemap class will allow alternative
dirstate implementations to replace the implementation.

Differential Revision: https://phab.mercurial-scm.org/D980
2017-10-05 11:34:41 -07:00
Durham Goode
f97f617524 dirstate: move nonnormal and otherparent sets to dirstatemap
As part of separating dirstate business logic from storage, let's move the
nonnormal and otherparent storage to the dirstatemap class. This will allow
alternative dirstate storage to persist these sets instead of recomputing them.

Differential Revision: https://phab.mercurial-scm.org/D979
2017-10-05 11:34:41 -07:00
Durham Goode
99779c0bbb dirstate: move write into dirstatemap
As part of separating the dirstate business logic from the dirstate storage
logic, let's move the serialization code down into dirstatemap.

Differential Revision: https://phab.mercurial-scm.org/D978
2017-10-05 11:34:41 -07:00
Durham Goode
76bcc9b3be dirstate: move _read into dirstatemap
As part of separating the dirstate business logic from the storage, let's move
the read code into the new dirstatemap class.

Differential Revision: https://phab.mercurial-scm.org/D977
2017-10-05 11:34:41 -07:00
Boris Feld
7fa654bef2 configitems: register the 'templates' section 2017-10-08 21:29:24 +02:00
Boris Feld
1dca7c7296 configitems: register the 'paths' config section 2017-10-11 05:01:55 +02:00
Boris Feld
2ea04ee5d5 configitems: register the 'pager.attend-.*' options 2017-10-11 02:26:09 +02:00
Boris Feld
9296910ea4 configitems: register the 'hooks' config section 2017-10-13 16:39:06 +02:00
Boris Feld
0748d57ee7 configitems: register the 'extensions' section 2017-10-10 10:48:47 +02:00
Boris Feld
90436ba7a8 configitems: register the 'defaults' section 2017-10-08 20:39:51 +02:00
Boris Feld
04cc694185 configitems: register the 'committemplate' section 2017-10-08 21:02:02 +02:00
Boris Feld
abe633ebaf configitems: register the 'color' section 2017-10-10 10:49:28 +02:00
Boris Feld
101b5cf034 configitems: register the 'alias' section 2017-10-08 20:26:25 +02:00
Boris Feld
f9a854f7cf configitems: allow for the registration of "generic" config item
Some section can contains arbitrary keys (eg: color, alias, extensions). We
add a way to register some generic config items for them. This is necessary to
get all the config registered. We use a regular expression because some sub-
attributes (eg: hooks.xxx.priority) can define default value on their own.
2017-10-10 10:49:15 +02:00
Denis Laxalde
9efc7f05e3 transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Upon pull or unbundle, we display a message with the range of new revisions
fetched. This revision range could readily be used after a pull to look out
what's new with 'hg log'. The algorithm takes care of filtering "obsolete"
revisions that might be present in transaction's "changes" but should not be
displayed to the end user.
2017-10-12 09:39:50 +02:00
Yuya Nishihara
1b540c162d i18n: cache translated messages per encoding
This is a simpler workaround alternative to D958, "i18n: clean msgcache when
encoding changes." The cache won't be bloated unless you run tons of commands
with different --encoding options on command server, or serve many repositories
of different web.encoding options on hgweb.

The test was originally written by Jun Wu.

Differential Revision: https://phab.mercurial-scm.org/D1053
2017-10-13 21:36:10 +09:00
Yuya Nishihara
239bc0e96c templater: fix ifcontains() to handle type mismatch gracefully
This was unintentionally changed in b8023e389b64. Since ifcontains() takes
needle of any types, it shouldn't abort depending on the given container type.
2017-10-12 22:09:11 +09:00
Yuya Nishihara
11659330ed help: use single quotes in `template example`
It was hard to read because ``""`` was rendered as """".
2017-10-12 21:56:13 +09:00
Yuya Nishihara
b3bcc5233c help: hide template keywords of obsolescence as they are still experimental 2017-10-12 21:48:02 +09:00
Yuya Nishihara
c9014c6361 help: fix formatting of template keywords
Our minirst formatter can't render multi-paragraph definition lists well.
Also added periods where appropriate.
2017-10-12 21:42:42 +09:00
Yuya Nishihara
9618d42102 chg: remove outdated rule to start test server
This rule is no longer useful because chg daemon may be killed and respawned
per config/environment hash. We can't reliably run a daemon in foreground.
2017-10-12 22:21:14 +09:00
Yuya Nishihara
a312ee40fa configitems: drop redundant default of web.allow<archtype>
Otherwise develwarn would be sent to stderr. I've added blackbox logging
to capture warnings.
2017-10-13 00:22:54 +09:00
Yuya Nishihara
607219189c configitems: correct default values of web.allow<archtype> and web.hidden
The default of ui.configbool() is False unless explicitly specified.
2017-10-13 00:14:28 +09:00
Yuya Nishihara
1f85a4e152 bdiff: include compat.h in header to define ssize_t
Before cb121eb76276, compat.h was included first so it happened to work.
But we shouldn't rely on the include order.
2017-10-13 22:38:24 +09:00
Boris Feld
97857d3a8e test: add an extra case for obsolescence distributed case
This changeset introduces a new documented test case for a distributed
obsolescence scenario. The scenario involves a simple case where some
obsolescence markers are retrieved before the changeset they affect. See the
test case documentation for details.

We also test variants where the changesets are added from a bundle.
2017-09-30 22:37:20 +01:00
Boris Feld
49725ddf88 test: add a test file dedicated to an important distributed case
This test file introduces documented test case for obsolescence markers usage
that are important to distributed workflow cases.

In the distributed case, new changesets, markers, and phases can be added in
orders that would not happen during the local only usage. Documenting these
scenarios and test them is important as we make progress with various
obsolescence aspects.
2017-09-29 19:59:15 +01:00
Pulkit Goyal
9492c3a9ec repoview: remove incorrect documentation of the function
In repoview.py, computeunserved() and computemutable() functions had the same
documentation. The documentation of computemutable() is wrong. I was unable to
write documentation for the function but it's better to not having the
documentation than having it wrong.

Differential Revision: https://phab.mercurial-scm.org/D1016
2017-10-10 23:19:35 +05:30
Jun Wu
b882ee58de check-code: suggest pycompat.is(posix|windows|darwin)
Differential Revision: https://phab.mercurial-scm.org/D1037
2017-10-12 09:34:58 -07:00
Jun Wu
79d026fdfe codemod: use pycompat.isdarwin
This is done by:

  sed -i "s/pycompat\.sysplatform == 'darwin'/pycompat.isdarwin/" **/*.py

Plus a manual change to `sslutil.py` which involves indentation change that
cannot be done by `sed`.

Differential Revision: https://phab.mercurial-scm.org/D1035
2017-10-12 23:34:34 -07:00
Jun Wu
72d17900ca codemod: use pycompat.isposix
This is done by:

  sed -i "s/pycompat\.osname == 'posix'/pycompat.isposix/" **/*.py

Differential Revision: https://phab.mercurial-scm.org/D1036
2017-10-12 09:04:22 -07:00
Jun Wu
2ae56b14de codemod: use pycompat.iswindows
This is done by:

  sed -i "s/pycompat\.osname == 'nt'/pycompat.iswindows/" **/*.py
  sed -i "s/pycompat\.osname != 'nt'/not pycompat.iswindows/" **/*.py
  sed -i 's/pycompat.osname == "nt"/pycompat.iswindows/' **/*.py

Differential Revision: https://phab.mercurial-scm.org/D1034
2017-10-12 23:30:46 -07:00
Jun Wu
7b62930cd9 pycompat: define operating system constants
As suggested by Ryan in D1019, it's cleaner if we use defined constants
instead of `osname == 'nt'` everywhere.

Differential Revision: https://phab.mercurial-scm.org/D1033
2017-10-12 19:20:04 -07:00
Jun Wu
d91707e2a4 hgweb: do not import uuid immediately to avoid its side effect
With hgdemandimport disabled (chg's case), `import uuid` has an immediate
side effect calling `ctypes.util.find_library` trying to locate the
`libuuid` library.  This happens at `import` time before `dispatch.run()`.
The call trace is like:

  File "hg/hg", line 54, in <module>
    from mercurial import (
  File "hg/mercurial/dispatch.py", line 24, in <module>
    from . import (
  File "hg/mercurial/commands.py", line 23, in <module>
    from . import (
  File "hg/mercurial/help.py", line 33, in <module>
    from .hgweb import (
  File "hg/mercurial/hgweb/__init__.py", line 20, in <module>
    from . import (
  File "hg/mercurial/hgweb/hgweb_mod.py", line 14, in <module>
    from .common import (
  File "hg/mercurial/hgweb/common.py", line 15, in <module>
    import uuid
  File "/usr/lib64/python2.7/uuid.py", line 404, in <module>
    lib = ctypes.CDLL(ctypes.util.find_library(libname))

The problem is, `ctypes.util.find_library` will execute
`sh -c '/sbin/ldconfig -p 2>/dev/null'` on Python <= 2.7.12. The output of
`sh` may pollute the terminal:

  shell-init: error retrieving current directory: getcwd: cannot access
  parent directories: No such file or directory

This patch moves `import uuid` so its side-effect can only happen after the
cwd check in `dispatch._getlocal`. Therefore the terminal won't be
polluted by importing `uuid`.

Differential Revision: https://phab.mercurial-scm.org/D1024
2017-10-11 21:24:32 -07:00
Jun Wu
6c6917ead6 check-code: forbid platform.system()
See the previous patches for the reason.

Differential Revision: https://phab.mercurial-scm.org/D1021
2017-10-11 17:42:57 -07:00
Jun Wu
fdee39a8b7 largefiles: do not use platform.system()
See the previous patch for the reason.

Differential Revision: https://phab.mercurial-scm.org/D1020
2017-10-11 17:42:35 -07:00