Commit Graph

19966 Commits

Author SHA1 Message Date
Augie Fackler
d57f1641f5 templatefilters: defend against evil unicode strs in json filter
We only want to do I/O in terms of bytes, so lets explode early
instead of recursing forever.

Differential Revision: https://phab.mercurial-scm.org/D1136
2017-10-16 22:44:43 -04:00
Boris Feld
a5658f8623 phase: use a binary phase part to push through bundle2 (BC)
The part we are using for pull is now used for push too. As we no longer use
pushkey, pushkey hooks are no longer triggered. This is an obvious backward
incompatible change. We could artificially trigger the pushkey hook within the
bundle2 part, but this seemed too hacky to me.

An option would be to disable by default this new mechanism for a couple of
versions to help people migrate to `txnclose-phase`. I took the liberal and
optimistic path to just turn it on by default directly.

.. bc::

   Push no longer triggers a pushkey hook when updating phases. Use the new
   `txnclose-phase` and `txnclose-phase` hooks instead.
   (Applies when both server and client use version 4.4 or above).
2017-09-20 19:38:06 +02:00
Phil Cohen
ed7cf84951 arbitraryfilecontext: skip the cmp fast path if any side is a symlink
`filecmp` follows symlinks by default, which a `filectx.cmp()` call should not
be doing as it should only compare the  requested entry. After this patch, only
the contexts' data are compared, which is the correct contract.

This is a corrected version of D1122.

Differential Revision: https://phab.mercurial-scm.org/D1165
2017-10-17 12:41:24 -07:00
Mark Thomas
8e56a1507b context: audit paths before clearing unknown files and dirs
Fix regression introduced in D785.

In some circumstances, context.clearunknown can be called before the path is
audited. Audit the path before deleting any conflicting files.

Differential Revision: https://phab.mercurial-scm.org/D1157
2017-10-17 08:11:13 -07:00
Boris Feld
ad5f3bc109 configitems: move rebase config into core
The shelve extensions import and call rebase content without loading the
extension. This is problematic as the config items rebase uses are not
declared and the default value are not set, etc...

The shelve extension should be using core utilities only and the necessary bit
should be moved from rebase into core. In the meantime, I'm taking a small
step to get config registration completed with minimal overhead. The rebase
extension is shipped with core so registering its config option within core is
not a big issue.

This is the last step needed before we can install a warning that enforces all
config to be registered.
2017-10-13 23:00:31 +02:00
Boris Feld
3796be0790 configitems: register the 'web.archivesubrepos' config 2017-10-16 18:16:29 +02:00
Boris Feld
6241e08062 configitems: register the 'experimental.effect-flags' config 2017-10-08 22:22:27 +02:00
Boris Feld
ed9a31a26e configitems: register the full 'merge-tools' config and sub-options
We register the merge-tools config section (which has an arbitrary base config
value) and the possible sub-attribute. The sub-attribute has to be registered
first or at the same time otherwise the '.*' item would shadow them.

Merge tools could include "." in their name so we can't constrain any more
than just ".*".
2017-10-08 20:37:13 +02:00
Paul Morelle
549788470a revlog-sparse-read: add a lower-threshold for read block size
The option experimental.sparse-read.min-block-size specifies the minimal size
of a deltachain span, under which it won't be split by _slicechunk.
2017-10-14 17:05:41 +02:00
Paul Morelle
d1288f1f44 revlog: introduce an experimental flag to slice chunks reads when too sparse
Delta chains can become quite sparse if there is a lot of unrelated data between
relevant pieces. Right now, revlog always reads all the necessary data for the
delta chain in one single read. This can lead to a lot of unrelated data to be
read (see issue5482 for more details).
One can use the `experimental.maxdeltachainspan` option with a large value
(or -1) to easily produce a very sparse delta chain.

This change introduces the ability to slice the chunks retrieval into  multiple
reads, skipping large sections of unrelated data. Preliminary testing shows
interesting results. For example the peak memory consumption to read a manifest
on a large repository is reduced from 600MB to 250MB (200MB without
maxdeltachainspan). However, the slicing itself and the multiple reads can have
an negative impact on performance. This is why the new feature is hidden behind
an experimental flag.

Future changesets will add various parameters to control the slicing heuristics.
We hope to experiment a wide variety of repositories during 4.4 and hopefully
turn the feature on by default in 4.5.
As a first try, the algorithm itself is prone to deep changes. However, we wish
to define APIs and have a baseline to work on.
2017-10-10 17:50:27 +02:00
Paul Morelle
6d907667b2 revlog: ignore empty trailing chunks when reading segments
When a merge commit creates an empty diff in the revlog, its offset may still
be quite far from the end of the previous chunk.
Skipping these empty chunks may reduce read size significantly.
In most cases, there is no gain, and in some cases, little gain.
On my clone of pypy, `hg manifest` reads 65% less bytes (96140 i/o 275943) for
revision 4260 by ignoring the only empty trailing diff.
For revision 2229, 35% (34557 i/o 53435)
Sadly, this is difficult to reproduce, as hg clone can make its own different
structure every time.
2017-10-09 15:13:41 +02:00
Boris Feld
a3e217804d phase: isolate logic to update remote phrase through bundle2 pushkey
Move the logic to build bundle2 pushkey part into its dedicated function. It
will help to keep the logic clear when adding support for sending phases change
using 'phase-heads' part.
2017-09-20 19:17:37 +02:00
Boris Feld
e0099ff757 phase: generate a push-race detection part on push
We are about to switch phase pushing from using pushkey to using a the new
dedicated binary part. We introduce the push race detection on its own to help
detect potential impact.
2017-10-11 07:40:00 +02:00
Boris Feld
f74c12124e phase: introduce a new 'check:phases' part
This part checks if revisions are still in the same phase as when the
bundle was generated. This is similar to what 'check:heads' or
'check:updated-heads' bundle2 part achieves for changesets.

We needs seems before we can move away from pushkey usage from phase since
pushkey has it own built-in push-race detection.
2017-10-11 07:13:02 +02:00
Boris Feld
68629fa552 phase: gather remote phase information in a summary object
We keep useful phase information around. The data will be reused with detecting
push-race in later changesets.
2017-10-11 18:39:04 +02:00
Boris Feld
048b95b938 phase: simplify the check for issue3781 shortcut in discovery
We'll rework the code around this check. Limiting the entanglement will help
with later changesets
2017-10-11 18:39:34 +02:00
Boris Feld
02117664d7 exchange: fix issue3781 reference in the comment
This comment is about:

  issue3781: Courtesy Phases synchronisation to publishing server prevent
             subrepo push
Not about:

  issue3871: Slow hg log when template contains {file_adds}, {file_mods} and
             {file_dels}
2017-10-16 12:36:42 +02:00
Boris Feld
bf2608127e phase: filter out non-draft item in "draft root"
The on-disk file can contain draft root that are descendants of secret root.
The resulting phase computation is correct, but the phases root content is
not. I will send another series to introduce code that remove some of the
cases where this can happens, but we first need to damage control the existing
case.

After this changeset, we can no longer advertise secret changeset as draft
root.
2017-10-11 20:08:02 +02:00
Matt Harbison
408a3898be subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)
Previously, only the top level repo was shared, and then any subrepos were
cloned on demand.  This is problematic because commits to the parent repo would
write an updated .hgsubstate to the share source, but the corresponding subrepo
commit would be stuck in the local subrepo.  That would prevent an update in the
source repo.  We already go to great lengths to avoid having inconsistent repos
(e.g., `hg push -r rev` will push _everything_ in a subrepo, even if it isn't
referenced in one of the parent's outgoing commits).  Therefore, this seems like
a bug fix, and there's no option to get the old behavior.  I can't imagine the
previous behavior was useful to anybody.

There shouldn't be an issue with svn, since it is centralized.  Maybe --git-dir
can be used for git subrepos, but I'll leave that to someone more familiar with
git.

An integer was previously being implicitly returned from commands.share(), which
caused dispatch() to start crashing when changing over to returning the shared
repo.  All error paths appear to raise, so this can be hardcoded to success.
The clone command checks for 'is None' in a similar pattern, but since
hg.clone() always returns a tuple, that seems wrong?

.. fix:: Issue 5675

   Creating a share of a repository with a Mercurial subrepository will now
   share the subrepository.

and

.. bc::

   Mercurial subrepositories are now shared instead of cloned when the parent
   repository is shared.  This prevents dangling subrepository references in the
   share source.  Previously shared repositories with cloned subrepositories
   will continue to function unchanged.
2017-10-15 22:48:02 -04:00
Augie Fackler
bcaad82b20 webcommands: replace str(ctx) etc with pycompat.bytestr(ctx) etc
hgweb can now serve the graph view in Python 3.

Differential Revision: https://phab.mercurial-scm.org/D1138
2017-10-16 22:51:58 -04:00
Augie Fackler
4c963a0721 templater: don't blow up when trying to build an abort message
__name__ is unicode, but we need bytes. For now, we'll make the
(mostly-safe) assumption that template filter names will be ascii.

Differential Revision: https://phab.mercurial-scm.org/D1137
2017-10-16 22:50:39 -04:00
Augie Fackler
45c9441c0e webutil: use pycompat.bytestr() instead of str()
Stops us from choking the templater on Python 3. With this patch
applied, much of hgweb works correctly in Python 3. The notable
exception is the graph page, which chokes because it gets node IDs as
str instead of bytes.

Differential Revision: https://phab.mercurial-scm.org/D1135
2017-10-16 22:44:06 -04:00
Augie Fackler
c6a33e23e1 hgweb: correct an earlier error of mine - start should be bytes
Gets hgweb very close to working with Python 3.

Differential Revision: https://phab.mercurial-scm.org/D1134
2017-10-16 22:43:19 -04:00
Boris Feld
902027adea config: simplify aliasing commands.update.check
experimental.updatecheck was renamed into commands.update.check, use the
config system to provides the fallback on the old config name instead of
adding more code.

Differential Revision: https://phab.mercurial-scm.org/D1117
2017-10-16 18:58:16 +02:00
Augie Fackler
44f638de23 mpatch: switch alignment of wrapped line from tab to spaces with clang-format
I may be a weird person for liking this style, but our C style is
historically nominally the Linux Kernel style, and when you configure
clang-format to be kernel-ish, this is what you get. If we want to
change it, we can do so by tweaking the formatter rules in the future.

Differential Revision: https://phab.mercurial-scm.org/D1132
2017-10-04 11:00:04 -04:00
Augie Fackler
210a208635 mpatch: reformat function prototypes with clang-format
Differential Revision: https://phab.mercurial-scm.org/D1131
2017-10-04 10:56:33 -04:00
Ryan McElroy
97fa443439 merge: allow user to halt merge on merge-tool failures
Depends on D932.

Call the new _onfilemergefailure function when a merge tool reports failure
via a return code.

Differential Revision: https://phab.mercurial-scm.org/D951
2017-10-06 06:48:43 -07:00
Ryan McElroy
cc72ebf3bc filemerge: introduce functions to halt merge flow
Depends on D931.

This patch introduces functions and a config option that will allow a user
to halt the merge if there are failures during a file merge. These functions
will be used in the next patch.

Differential Revision: https://phab.mercurial-scm.org/D932
2017-10-06 06:48:43 -07:00
Pulkit Goyal
8fe8ec1089 cmdutil: pass metadata from amend() to cleanupnodes
`commit --amend` and amend command in core and extensions rely on
cmdutil.amend() for amending a commit. So the logic to add a note to amend must
reside here. This patch assumes that note will be passed in opts dictionary to
the function and it will be passed to cleanupnodes and then createmarkers to
store the note in the obsmarker metadata.

After this patch, note can be stored on an amend changeset by passing notes as a
part of opts to cmdutil.amend().

Differential Revision: https://phab.mercurial-scm.org/D1094
2017-10-15 15:32:03 +05:30
Pulkit Goyal
66d216220e scmutil: add capability to cleanupnodes to take obsmarker metadata
This patch adds a metadata argument to cleanupnodes() which will be dict and can
be passed to obsmarker.createmarkers() and can be stored on the obsmarker.
In cases when obsolescence is not enabled, the metadata argument is useless.

This is a step towards storing a note in amend.

Differential Revision: https://phab.mercurial-scm.org/D1093
2017-10-15 14:34:24 +05:30
Phil Cohen
a04280b2f9 context: add workingfilectx.markcopied
With in-memory merge, copy information needs to be stored in-memory, not in the
dirstate.

To make this transition easy, move the existing dirstate-based approach to
workingfilectx; that way, other implementations can choose to store it
somewhere else.

Differential Revision: https://phab.mercurial-scm.org/D1106
2017-10-15 20:36:29 -07:00
Phil Cohen
fac2e07a2a merge: don't use workers in in-memory mode
The worker processes can't share memory, so workers should not be used.

Differential Revision: https://phab.mercurial-scm.org/D1105
2017-10-15 20:36:29 -07:00
Phil Cohen
a76f841e4e filemerge: add a missing flushall()
Differential Revision: https://phab.mercurial-scm.org/D1060
2017-10-15 20:36:29 -07:00
Phil Cohen
a93f277c4b filemerge: store backups in the overlayworkingctx if using imm
Differential Revision: https://phab.mercurial-scm.org/D1059
2017-10-13 12:34:22 -07:00
Phil Cohen
220e45c6d6 context: add overlayfilectx.cmp()
Differential Revision: https://phab.mercurial-scm.org/D1058
2017-10-13 12:34:22 -07:00
Phil Cohen
e16963ee65 filemerge: use arbitraryfilectx for backups
With in-memory merge, backup files might be overlayworkingfilectxs stored
in memory. But they could also be real files if the user's backup directory is
outside the working dir.

Rather than have two code paths everywhere, let's use arbitraryfilectx so they
can be consistent.

Differential Revision: https://phab.mercurial-scm.org/D1057
2017-10-16 13:10:55 -07:00
Pulkit Goyal
aaa435b086 registrar: add support for storing the type of command in func object
This patch adds support for storing the type of command which is going to run in
the func object. For this it does the following:

1) Add three possible values as attributes to the registrar.command class
2) Add a new argument to registrar.command._doregister function
3) Add a new attribute cmdtype to the func object

The type of command will be helpful in deciding what level of access on hidden
commits it can has.

Differential Revision: https://phab.mercurial-scm.org/D736
2017-09-20 04:47:43 +05:30
Boris Feld
9d80c5624f configitems: register the 'hostsecurity.*:verifycertsfile' config 2017-10-14 00:30:14 +02:00
Boris Feld
2c9df67473 configitems: register the 'hostsecurity.*:fingerprints' config 2017-10-14 00:29:31 +02:00
Boris Feld
3411c59c2f configitems: register the 'hostsecurity.*:ciphers' config 2017-10-14 00:28:48 +02:00
Boris Feld
a087914d79 configitems: register the 'hostsecurity.*:minimumprotocol' config 2017-10-14 00:28:13 +02:00
Boris Feld
c8ced9d060 configitems: register the 'extdata' section 2017-10-13 23:23:48 +02:00
Boris Feld
967247e8ec configitems: fix registration of extensions config
The new 'itemregister' class should be used when loading the extension config.
This was and oversight when itemregister was introduced.
2017-10-13 23:33:31 +02:00
Boris Feld
4c94a47479 configitems: register the 'web.staticurl' config 2017-10-13 23:03:46 +02:00
Boris Feld
14093a3043 configitems: register the 'hgweb-paths' section 2017-10-12 00:44:45 +02:00
Boris Feld
eeada116f6 configitems: register the 'hostfingerprints' section 2017-10-12 00:20:41 +02:00
Boris Feld
a345bd5d76 configitems: register the 'hostsecurity.minimumprotocol' config 2017-10-12 00:19:12 +02:00
Boris Feld
cb6b7ec15b configitems: register the 'progress.format' config 2017-10-11 22:53:17 +02:00
Augie Fackler
27aba6c982 hgweb: fix decodevaluefromheaders to always return a bytes value
That's more in line with what we want, and we know it's ASCII data
since that's all HTTP technically allows in headers anyway.

Differential Revision: https://phab.mercurial-scm.org/D1112
2017-10-15 00:43:01 -04:00
Augie Fackler
386ad003ae hgweb: more "headers are native strs" cleanup
I'll fix the decodevaluefromheaders function in an upcoming change.

Differential Revision: https://phab.mercurial-scm.org/D1111
2017-10-15 00:42:25 -04:00