Commit Graph

20104 Commits

Author SHA1 Message Date
Gregory Szorc
35538a441a fsmonitor: warn when fsmonitor could be used
fsmonitor can significantly speed up operations on large working
directories. But fsmonitor isn't enabled by default, so naive users
may not realize there is a potential to make Mercurial faster.

This commit introduces a warning to working directory updates when
fsmonitor could be used.

The following conditions must be met:

* Working directory is previously empty
* New working directory adds >= N files (currently 50,000)
* Running on Linux or MacOS
* fsmonitor not enabled
* Warning not disabled via config override

Because of the empty working directory restriction, most users will
only see this warning during `hg clone` (assuming very few users
actually do an `hg up null`).

The addition of a warning may be considered a BC change. However, clone
has printed warnings before. Until recently, Mercurial printed a warning
with the server's certificate fingerprint when it wasn't explicitly
trusted for example. The warning goes to stderr. So it shouldn't
interfere with scripts parsing meaningful output.

The OS restriction was on the advice of Facebook engineers, who only
feel confident with watchman's stability on the supported platforms.

.. feature::

   Print warning when fsmonitor isn't being used on a large repository

Differential Revision: https://phab.mercurial-scm.org/D894
2017-10-18 22:57:15 +02:00
Saurabh Singh
8e631c99b7 ui: move request exit handlers to global state
Since the ui objects can be created with the 'load' class method, it
is possible to lose the exit handlers information from the old ui instance. For
example, running 'test-bad-extension.t' leads to this situation where chg
creates a new ui instance which does not copy the exit handlers from the
earlier ui instance. For exit handlers, which are special cases anyways, it
probably makes sense to have a global state of the handlers. This would ensure
that the exit handlers registered once are definitely executed at the end of
the request.

Test Plan:
Ran all the tests without '--chg' option. This also fixes the
'test-bad-extension.t' with the '--chg' option.

Differential Revision: https://phab.mercurial-scm.org/D1166
2017-10-17 13:20:25 -07:00
Paul Morelle
942b4f2e1a sparse-read: skip gaps too small to be worth splitting
Splitting at too small gaps might not be worthwhile. With this changeset,
we stop considering splitting on too small gaps. The threshold is configurable.
We arbitrarily pick 256K as a default value because it seems "okay".
Further testing on various repositories and setups will be needed to tune it.

The option name is 'experimental.sparse-read.min-gap-size`, and replaces
`experimental.sparse-read.min-block-size` which is not used any more.
2017-10-18 09:07:48 +02:00
Boris Feld
b5ee1a86a9 sparse-read: move from a recursive-based approach to a heap-based one
The previous recursive approach was trying to optimise each read slice to have
a good density. It had the tendency to over-optimize smaller slices while
leaving larger hole in others.

The new approach focuses on improving the combined density of all the reads,
instead of the individual slices. It slices at the largest gaps first, as they
reduce the total amount of read data the most efficiently.

Another benefit of this approach is that we iterate over the delta chain only
once, reducing the overhead of slicing long delta chains.

On the repository we use for tests, the new approach shows similar or faster
performance than the current default linear full read.

The repository contains about 450,000 revisions with many concurrent
topological branches. Tests have been run on two versions of the repository:
one built with the current delta constraint, and the other with an unlimited
delta span (using 'experimental.maxdeltachainspan=0')

Below are timings for building 1% of all the revision in the manifest log using
'hg perfrevlogrevisions -m'. Times are given in seconds. They include the new
couple of follow-up changeset in this series.

delta-span  standard    unlimited
linear-read     922s         632s
sparse-read     814s         566s
2017-10-18 12:53:00 +02:00
Matt Harbison
4856e00f46 subrepo: implement 'unshare' for Mercurial subrepos
I think there's a slight hole here in that a subrepo could be shared, removed
from .hgsub, and then it's not part of context.substate (so not iterated over).
But the push command has the same hole IIRC, and I think removing a subrepo is
an edge case.

The import hack is a copy/paste of subrepo.subrepo().
2017-10-17 22:55:33 -04:00
Matt Harbison
ae7841b944 share: move the implementation of 'unshare' to the 'hg' module
This will be used to setup unsharing subrepos.  Usually cmdutil is used for
this purpose.  But the implementation needs hg.copystore(), and the hg module
already imports cmdutil.
2017-10-17 21:48:56 -04:00
Denis Laxalde
13f0a4a653 show: use labelcset() template alias for work (and stack) views
By reusing labelcset() template alias from map-cmdline.default we can now
display obsolescence information in `hg show work/stack`.
2017-10-17 20:25:43 +02:00
Kevin Bullock
d9bf33fad2 phases: pass phase names to hooks instead of internal values 2017-10-18 12:19:53 -05:00
Boris Feld
aab8c43439 configitems: document the choice of using 'match' instead of 'search' 2017-10-18 12:36:23 +02:00
Boris Feld
ad198e9760 configitems: do not directly match generic items
Before this changesets, a literal '.*:foo$' config would match a registered
'.*:foo$' generic. This is wrong since generic should be matched through
regular exception only. This changeset fixes this problem.

Thanks for to Yuya Nishihara for spotting the issue.
2017-10-18 12:26:08 +02:00
Boris Feld
3df0c5d74a obsfate: fix obsfate_printer with empty date list
When the list of dates is empty, `min` and `max` would raises a ValueError.
Protect against this case by checking that the date list is not empty.

I didn't add a test because I couldn't find a reproducing test case.
2017-10-18 15:38:51 +02:00
Boris Feld
4b2916f625 config: gather allowdivergence under the evolution namespace
Grouping all evolution related-config under the experimental.evolution
namespace would helps the future migration outside [experimental].

Differential Revision: https://phab.mercurial-scm.org/D1155
2017-10-17 16:54:31 +02:00
Boris Feld
03a11d7666 config: remove stabilization.* aliases
Stabilization config items were never part of a release, remove them now that
we cleaned up the evolution related configuration.

Differential Revision: https://phab.mercurial-scm.org/D1154
2017-10-17 15:57:56 +02:00
Boris Feld
5f77fdf0f1 config: update evolution-related config
Update the evolution helpers function to support both old-style configuration and
new-style configuration:

    experimental.evolution=all is renamed into experimental.evolution=true

    experimental.evolution=createmarkers is renamed into
    experimental.evolution.createmarkers=true

    experimental.evolution=allowunstable is renamed into
    experimental.evolution.allowunstable=true

    experimental.evolution=exchange is renamed into
    experimental.evolution.exchange=true

We choose to not rename individual config options; keeping the same names
would easy the transition for users but it's something that could be easily
done in the future.

Differential Revision: https://phab.mercurial-scm.org/D1147
2017-10-16 17:14:47 +02:00
Boris Feld
35adc999b8 config: invert evolution-related configuration aliases
We want to split the evolution-related configuration and back-out the renaming
from evolution.* to stabilization.*.

First invert the configuration and aliases, so next changesets will be
cleaner.

Differential Revision: https://phab.mercurial-scm.org/D1146
2017-10-16 17:14:32 +02:00
Augie Fackler
7ca1f09f81 parsers: allow clang-format here
# skip-blame because parsers.c is mechanically rewritten by
clang-format with no semantic change.

Differential Revision: https://phab.mercurial-scm.org/D1170
2017-10-16 14:53:57 -04:00
Augie Fackler
90df42e97c cext: add /* header */ comment to all PyVarObject_HEAD_INIT() calls
This gives clang-format the right notion about formatting these struct
initializers, therefore allowing us to automatically format several
additional files.

# skip-blame because this is just a content-free comment addition

Differential Revision: https://phab.mercurial-scm.org/D1169
2017-10-16 14:49:35 -04:00
Boris Feld
8be76ccfef obsolete: activate effect-flag by default
Let's activate effect-flag by default as Evolve is experimental and in order
to gather feedback from users.
2017-11-01 17:08:33 +01:00
Boris Feld
59dcbd2a4d debug: print parsed bundle2 capabilities with debugcapabilities
The bundle2 capabilities are hard to read in their encoded form. We parse and
print them in a human friendly way.
2017-10-30 17:09:29 +01:00
Boris Feld
9554fcac46 debug: add a debugcapabilities commands
This new debugcommand prints the capabilities of any remote in a human friendly
way. Improved bundle2 capabilities support will be introduced in the next
changesets.
2017-10-30 17:08:16 +01:00
Augie Fackler
3ff9746218 revert: no longer mark --interactive as experimental
We seem to have settled down on behavior changes here (nothing
matching revset `keyword(revert) and keyword(interactive)` since 4.2
was released), so let's go ahead and advertise this excellent feature.

.. feature:: revert --interactive

  The revert command now accepts the flag --interactive to allow reverting
  only some of the changes to the specified files.
2017-10-30 17:46:07 -04:00
Augie Fackler
ffa2157901 ui: add configlist doctest to document a bit more of the whitespace behavior
I'm surprised this wasn't explicitly tested, so I added a test.
2017-10-25 23:01:54 -04:00
Augie Fackler
9ae9ebef63 parsers: protect some case-folding tables from clang-format
We want a slightly weird format here so that it's easier to read, but
in order to preserve that we need to disable clang-format.

Differential Revision: https://phab.mercurial-scm.org/D1168
2015-04-21 16:02:23 -04:00
Boris Feld
38f9c73dbd configitems: adds a developer warning when accessing undeclared configuration
Now that all known options are declared, we setup a warning to make sure it will
stay this way.

We disable the warning in two tests checking other behavior with random options.
2017-10-16 17:41:27 +02:00
Denis Laxalde
75398ab7ec log: add -L/--line-range option to follow file history by line range
We add an experimental -L/--line-range option to 'hg log' taking file patterns
along with a line range using the (new) FILE,FROMLINE-TOLINE syntax where FILE
may be a pattern (matching exactly one file). The resulting history is similar
to what the "followlines" revset except that, if --patch is specified,
only diff hunks within specified line range are shown.

Basically, this brings the CLI on par with what currently only exists in hgweb
through line selection in "file" and "annotate" views resulting in a file log
with filtered patch to only display followed line range.

The option may be specified multiple times and can be combined with --rev and
regular file patterns to further restrict revisions. Usage of this option
requires --follow; revisions are shown in descending order and renames are
followed. Only the --graph option is currently not supported.

The UI is the result of a consensus from review feedback at:

  https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-October/106749.html


The implementation spreads between commands.log() and cmdutil module.
In commands.log(), the main loop may now use a "hunksfilter" factory (similar
to "filematcher") that, for a given "rev", produces a filtering function
for diff hunks for a given file context object.
The logic to build revisions from -L/--line-range options lives in
cmdutil.getloglinerangerevs() which produces "revs", "filematcher" and
"hunksfilter" information. Revisions obtained by following files' line range
are filtered if they do not match the revset specified by --rev option. If
regular FILE arguments are passed along with -L options, both filematchers are
combined into a new matcher.

.. feature::

   Add an experimental -L/--line-range FILE,FROMLINE-TOLINE option to 'hg log'
   command to follow the history of files by line range. In combination with
   -p/--patch option, only diff hunks within specified line range will be
   displayed. Feedback, especially on UX aspects, is welcome.
2017-10-17 21:15:31 +02:00
Denis Laxalde
356644ac1a diff: pass a diff hunks filter function from changeset_printer to patch.diff()
We add a 'hunksfilterfn' keyword argument in all functions of the call
stack from changeset_printer.show() to patch.diff(). This is a callable
that will be used to filter out hunks by line range and will be used in
the "-L/--line-range" option of "hg log" command introduced in the
following changesets.
2017-10-06 14:45:17 +02:00
Denis Laxalde
f37bd71289 diff: also yield file context objects in patch.trydiff() (API)
And retrieve them in patch.diffhunks(). We'll use these in forthcoming
changesets to filter diff hunks by line range.
2017-10-05 21:20:08 +02:00
Denis Laxalde
5c56737c70 revset: extract a parsefollowlinespattern helper function
We'll need the same logic in forthcoming changeset to handle --line-range
option in 'hg log' command.
The function lives in scmutil.py (rather than util.py) as it uses match and
pathutil modules.
2017-10-04 15:27:43 +02:00
Boris Feld
c3010f59dd obsfate: add obsfate to default mapfile
Use the verbosity aware template keyword introduced earlier. It has the nice
property of being verbosity dependent but in order to customize the obsfate
part, users will need to replace the lobsfate definition from default mapfile
with the one using template functions (by copying the one from test-obsmarker-
template.t for example).

As it's a more advanced use-case, I'm more inclined to have the same code for
the {obsfate} keyword, in the changeset printer and in the default mapfile for
consistency.

But, the definition in default mapfile could be replaced with one based on
template filter to obsfate output customization if it is a big need for users.
2017-10-06 17:53:36 +02:00
Boris Feld
d09c69f7b8 log: add obsfate by default in changeset printer
Having an obsfate by default in log will be useful for users to understand why
they have obsolete and unstable changesets. Obsfate will only be shown for
obsolete changesets, which only happens if people opt-in to experimental feature.

But when obsolete changeset are visible, it is very useful to understand where
they are. Having it in log could be sufficient for most people, so they don't
have to learn a new command (like obslog which is itself useful in case of
divergences).

For example, when pulling and working directory parent become obsolete:

  $ hg pull
  ...
  working directory parent is obsolete! (f936c1697205)

This message comes from the Evolve extension.

Obsfate would comes handy:

  $ hg log -G
  o  changeset:   2:6f91013c5136
  |  tag:         tip
  |  parent:      0:4ef7b558f3ec
  |  user:        Boris Feld <boris.feld@octobus.net>
  |  date:        Mon Oct 09 16:00:27 2017 +0200
  |  summary:     A
  |
  | @  changeset:   1:f936c1697205
  |/   user:        Boris Feld <boris.feld@octobus.net>
  |    date:        Mon Oct 09 16:00:27 2017 +0200
  |    obsfate:     rewritten using amend as 2:6f91013c5136
  |    summary:     -A
  |
  o  changeset:   0:feb4dd822b8c
     user:        Boris Feld <boris.feld@octobus.net>
     date:        Tue Oct 09 16:00:00 2017 +0200
     summary:     ROOT

And once we update, we don't have an obsolete changeset in the log anymore so
we don't show obsfate anymore, most users won't see obsfate often if they
don't have obsolete changeset often:

  @  changeset:   2:6f91013c5136
  |  tag:         tip
  |  parent:      0:4ef7b558f3ec
  |  user:        Boris Feld <boris.feld@octobus.net>
  |  date:        Mon Oct 09 16:00:27 2017 +0200
  |  summary:     A
  |
  o  changeset:   0:feb4dd822b8c
     user:        Boris Feld <boris.feld@octobus.net>
     date:        Tue Oct 09 16:00:00 2017 +0200
     summary:     ROOT
2017-10-05 15:25:18 +02:00
Boris Feld
d580cec6cc obsfate: only display date in verbose mode
The date is also not that helpful in most cases but we show it in verbose mode.
2017-10-09 15:34:26 +02:00
Boris Feld
98e0e19dcc obsfate: filter out current user if not in verbose
Obsolescence is sometimes used only locally so the obs-marker users is always
the same. Showing the user in this case does not bring much values.

In the case where multiple users rewrite the commit, display the full list of
users. Also show all users in verbose mode.
2017-10-09 15:34:12 +02:00
Boris Feld
142a0c0bf5 ui: add the possibility to returns None as username in ui
In a later patch we want to retrieve the current username or None if it isn't
defined. Add the acceptempty parameter instead of catching Abort.
2017-10-06 16:23:47 +02:00
Boris Feld
4ed4f0d702 templatekw: introduce obsfate keyword
Introduce an obsfate printer that uses all helpers functions defined in
obsutil to get all the obsfate-related data and format a string according to
the current format in test-obsmarker-template.t.

Then, introduce an obsfate templatekw that uses the obsfateprinter to return a
list of strings.

The goal is not to replace existing obsfate template functions but to propose
a default, good-enough and easily usable obsfate definition for end-users that
don't want to customize it. Such output would ultimately get included in the
default log output.

Here are some output examples for a commit amended:

rewritten using amend as 5:a9b1f8652753 by test (at 1970-01-01 00:00 +0000)

Next patches will make the output dependent on the verbosity.

Exemple of use-cases:

For having the obsfate on a single-line between brackets:

  {if(obsfate, " [{join(obsfate, "; ")}]")}

For having the obsfate in several lines:

  {if(obsfate, "{obsfate % "  Obsfate: {fate}\n"}")}
2017-10-05 17:42:56 +02:00
Pulkit Goyal
98c13e4c70 copies: add a config to limit the number of candidates to check in heuristics
The heuristics algorithm find possible candidates for move/copy and then check
whether they are actually a copy or move. In some cases, there can be lot of
candidates possible which can actually slow down the algorithm.

This patch introduces a config option
`experimental.copytrace.movecandidateslimit` using which one can limit the
candidates to check. The limit defaults to 100.

Thanks to Yuya for suggesting to skip copytracing for that file with a
warning.

Differential Revision: https://phab.mercurial-scm.org/D987
2017-10-10 02:25:03 +05:30
Martin von Zweigbergk
3fba6ca94a extensions: always include traceback when extension setup fails
I have spent a lot of time debugging extensions that failed to load
because we don't include a traceback and I didn't realize I could get
traceback for the extension failure with --traceback. Let's just turn
them on by default, since it should be rare that the user sees these
tracebacks anyway (and if they do, it's not so bad if the extra
traceback pushes them a little harder to report the problem).

Since we already had a test case with --traceback and one without, I
just removed the one with the flag.

Differential Revision: https://phab.mercurial-scm.org/D1164
2017-10-17 10:31:44 -07:00
Jun Wu
4fede3d6bc test-show: make it compatible with chg
The show extension reads `commands.show.aliasprefix` config in its
`extsetup` and that causes issues with chg. This patch adds that config item
to chg confighash to solve the issue.

Test Plan:
`run-tests.py -l --chg test-show.t`

Differential Revision: https://phab.mercurial-scm.org/D1158
2017-10-17 10:41:56 -07:00
Augie Fackler
22d88dd8c3 templater: use pycompat.sysbytes to bytes-ify some __name__ attrs
Spotted by yuya in review of 093b17c57344.

Differential Revision: https://phab.mercurial-scm.org/D1145
2017-10-17 10:51:43 -04:00
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
Augie Fackler
db6ecaafd2 hgweb: when unpacking args from request form, convert to bytes
We assume http-originated values are ASCII, which should be safe based
on the RFC.

Differential Revision: https://phab.mercurial-scm.org/D1110
2017-10-15 00:41:34 -04:00
Augie Fackler
4b3002a912 wireproto: more strkwargs cleanup
Differential Revision: https://phab.mercurial-scm.org/D1109
2017-10-15 00:39:53 -04:00
Augie Fackler
22c84078c4 hgweb: more "http headers are native strs" cleanup
Differential Revision: https://phab.mercurial-scm.org/D1108
2017-10-15 00:38:33 -04:00
Augie Fackler
4fa42c83ce wireproto: bounce kwargs to/from bytes/str as needed
Differential Revision: https://phab.mercurial-scm.org/D1107
2017-10-15 00:05:43 -04:00
Boris Feld
5068121d4c configitems: fixup default value of annotate config option
It turned out that configbool is used for most of them so the registered
default value was wrong.
2017-10-16 15:12:50 +02:00
Denis Laxalde
ff300063f3 transaction-summary: use a revset to filter obsoletes in reportnewcs()
Thanks to Yuya Nishihara for suggesting.
2017-10-16 15:35:08 +02:00
Boris Feld
834dcb3800 configitems: fixup default value of diff config option
It turned out that configbool is used for most of them so the registered
default value was wrong.
2017-10-13 22:08:55 +02:00
Boris Feld
2253c06027 devel-warn: add 'warn-' to 'devel.empty-changegroup' config
Rename 'devel.empty-changegroup' to 'devel.warn-empty- changegroup' in order
to clarify it controls a warning message.

No alias is installed since the previous configuration option was not
documented.
2017-10-08 21:42:32 +02:00
Augie Fackler
25449b9adb peer: ensure command names are always ascii bytestrs
Differential Revision: https://phab.mercurial-scm.org/D1104
2017-10-15 00:05:00 -04:00
Augie Fackler
aff2a14d65 httppeer: always produce native str header keys and values
Differential Revision: https://phab.mercurial-scm.org/D1103
2017-10-15 00:03:31 -04:00
Augie Fackler
f4a2677719 wireproto: use %d to encode int, not %s
Differential Revision: https://phab.mercurial-scm.org/D1102
2017-10-15 00:40:07 -04:00
Augie Fackler
29944e3fdf wireproto: use a proper exception instead of assert False
Differential Revision: https://phab.mercurial-scm.org/D1101
2017-10-15 00:06:06 -04:00
Augie Fackler
7914273147 wireproto: use listcomp instead of map()
The latter returns a generator object on Python 3, which breaks
various parts of hg that expected a list.

Differential Revision: https://phab.mercurial-scm.org/D1100
2017-10-15 00:39:29 -04:00
Augie Fackler
e90604cb5e dagutil: use a listcomp instead of a map()
In Python 3, the map() returns a generator object instead of a list,
and some parts of hg depend on this being consumable more than once or
sortable in place.

Differential Revision: https://phab.mercurial-scm.org/D1099
2017-10-15 00:37:24 -04:00
Augie Fackler
510310c11a peer: when collecting method names for batch calls, bytes-ify __name__
This will explode violently if we have a non-ascii command name. That
shouldn't ever happen in core, and seems unlikely even in third-party
code. Regardless, it'll explode violently, so we can revisit things in
the future if we need to change the encoding here.

Differential Revision: https://phab.mercurial-scm.org/D1092
2017-10-14 12:03:42 -04:00
Augie Fackler
6509db2306 python3: replace im_{self,func} with __{self,func}__ globally
These new names are portable back to Python 2.6.

Differential Revision: https://phab.mercurial-scm.org/D1091
2017-10-14 12:02:15 -04:00
Augie Fackler
e5d72894dc httppeer: extract content-type from headers using native str
Differential Revision: https://phab.mercurial-scm.org/D1090
2017-10-14 12:00:35 -04:00
Augie Fackler
74dcc6aa29 httppeer: convert request url back to bytes before inspecting it
Differential Revision: https://phab.mercurial-scm.org/D1089
2017-10-14 11:59:51 -04:00
Augie Fackler
ffc31606d6 templater: explode if we try to emit a str
Without this if branch, we infinitely recurse in _flatten, which is
very confusing. Something in an hgweb template is trying to write out
a string instead of a bytes on Python 3, and this at least makes it
crash politely.

Differential Revision: https://phab.mercurial-scm.org/D1088
2017-10-14 11:30:17 -04:00
Augie Fackler
1eb0868158 hgweb: fill in content-type and content-length as native strings
This lets me actually get a capabilities response from hgweb over
http.

Differential Revision: https://phab.mercurial-scm.org/D1087
2017-10-14 11:20:31 -04:00
Augie Fackler
d3a0083e45 hgweb: mimetype guessing needs a unicode path
Differential Revision: https://phab.mercurial-scm.org/D1086
2017-10-14 10:47:29 -04:00
Augie Fackler
dfaf4b98bc hgweb: set sent_headers attr as early as practical
While doing Python 3 porting work, I've seen exceptions happen in
parts of hgweb we normally assume are robust. It won't hurt anything
to set this attribute significantly earlier, so let's do so and save
confusing during the porting process.

Differential Revision: https://phab.mercurial-scm.org/D1085
2017-10-14 15:37:33 -04:00
Augie Fackler
caec472139 hgweb: detect Python 3-era libraries and use modern attribute names
Differential Revision: https://phab.mercurial-scm.org/D1084
2017-10-05 14:53:52 -04:00
Augie Fackler
1f7e395752 server: indent block that's about to get conditionalized
Differential Revision: https://phab.mercurial-scm.org/D1083
2017-10-14 15:53:36 -04:00
Yuya Nishihara
62122f42ea templates: fix missed space between instability labels 2017-10-14 18:41:20 +09:00
Yuya Nishihara
0e862d288f templates: introduce labelcset() function in map-cmdline.default as example 2017-10-14 18:24:01 +09:00
Yuya Nishihara
550442a9eb templater: load aliases from [templatealias] section in map file
This seems sometimes useful as an alias can be a function, but a template
fragment can't.
2017-10-14 18:06:42 +09:00
Yuya Nishihara
994c332a3b templater: load template fragments from [templates] section in map file
This allows us to %include map-cmdline.<style> file in our .hgrc files. The
syntax is slightly different as hgrc doesn't support loading an external
template file, but map-cmdline files don't use this feature, so the syntax
can be considered identical in practice.

Unnamed section is remapped for backward compatibility.
2017-10-14 17:51:01 +09:00
Yuya Nishihara
615ab8c775 config: allow remapping the default section
The next patch depends on it. It doesn't make sense that the default section
can't be remapped with {'': whatever}.
2017-10-14 17:41:41 +09:00
Yuya Nishihara
e2e58c1839 templater: simplify merge of __base__ dicts by reading it first 2016-08-20 18:33:02 +09:00
Boris Feld
3905794a8c phase: add a dedicated pretxnclose-phase hook
This new hook mirror the newly introduced 'txnclose-phase' but can abort the
transaction.
2017-10-08 17:23:18 +02:00
Boris Feld
5dfba786e8 phase: add a dedicated txnclose-phase hook
The new 'txnclose-phase' hook expose the phase movement information stored in
'tr.changes['phases]'. To provide a simple and straightforward hook API to the
users, we introduce a new hook called for each revision affected.  Since a
transaction can affect the phase of multiple changesets, updating the existing
'txnclose' hook to expose that information would be more complex. The data for
all moves will not fit in environment variables and iterations over each move
would be cumbersome. So the introduction of a new dedicated hook is
preferred in this changesets.

This does not exclude the addition of the full phase movement information to
the existing 'txnclose' in the future to help write more complex hooks.
2017-10-08 17:50:46 +02:00
Boris Feld
db2e8fadae bookmark: add a dedicated pretxnclose-bookmark hook
This new hook mirror the newly introduced 'txnclose-bookmark' but can abort the
transaction.
2017-10-08 18:50:14 +02:00
Boris Feld
4815e3ce8d bookmark: add a dedicated txnclose-bookmark hook
The new 'txnclose-bookmark' hook expose the bookmark movement information
stored in 'tr.changes['bookmarks]'. To provide a simple and straightforward
hook API to the users, we introduce a new hook called for each bookmark
touched. Since a transaction can affect multiple bookmarks, updating the
existing 'txnclose' hook to expose that information would be more complex. The
data for all moves might not fit in environment variables and iterations over
each move would be cumbersome. So the introduction of a new dedicated hook is
preferred in this changeset.

This does not exclude the addition to the full bookmark information to the
existing 'txnclose' in the future to help write more complex hooks.
2017-10-10 17:53:42 +02:00
Augie Fackler
83f88ecb85 tweakdefaults: make commands.update.check be noconflict
This is the second-safest option we have to offer in `updatecheck`,
with `abort` being the safest and `linear` being the default. At the
sprint we discussed how much `none` and `linear` make us all
uncomfortable, and how we'd like to move the default behavior if we can.

I'm not sure we can get away with actually changing the out of the box
default behavior, but we can at *least* do this.

Differential Revision: https://phab.mercurial-scm.org/D1062
2017-10-13 15:58:54 -04:00
Augie Fackler
bc69639184 hgweb: fix logging to use native strings as appropriate
Kind of a tangled mess, but now logging works in both Python 2 and 3.

# no-check-commit because of the interface required by Python's HTTP
server code.

Differential Revision: https://phab.mercurial-scm.org/D1080
2017-10-14 15:43:06 -04:00
Augie Fackler
2fea5f41d1 config: graduate experimental.updatecheck to commands.update.check
.. feature::

  New `commands.update.check` feature to adjust constraints on when
  `hg update` will allow updates with a dirty working copy.

also

.. bc::

    The `experimental.updatecheck` name for the new `commands.update.check`
    feature is now deprecated, and will be removed after this release.

Differential Revision: https://phab.mercurial-scm.org/D1070
2017-10-14 03:13:50 -04:00
Augie Fackler
3327fe780e hgweb: rewrite most obviously-native-strings to be native strings
This clearly won't be everything, but it unblocks a fair amount of
stuff here.

Differential Revision: https://phab.mercurial-scm.org/D1079
2017-10-14 15:42:38 -04:00
Augie Fackler
9f097cd648 hgweb: use native strings consistently for querystring parsing
Differential Revision: https://phab.mercurial-scm.org/D1078
2017-10-05 14:48:52 -04:00
Augie Fackler
4fec03fc61 hgweb: rewrite two X or Y and Z ad-hoc ternaries with Y if X else Z
Just easier to muddle through for my brain now that I don't see the
old pattern much anymore.

Differential Revision: https://phab.mercurial-scm.org/D1077
2017-10-05 14:48:31 -04:00
Augie Fackler
14c0f38685 httppeer: use native strings for headers
On Python 3, we need to use unicodes, rather than bytes. This lets
test-pull.t get a lot further along.

Differential Revision: https://phab.mercurial-scm.org/D887
2017-10-01 12:12:34 -04:00
Augie Fackler
58adac28f6 hgweb: more native string treatment in query string parsing
Differential Revision: https://phab.mercurial-scm.org/D1076
2017-10-05 14:29:51 -04:00
Augie Fackler
97ea947740 httppeer: pass url to urllib as native str, not bytes
Differential Revision: https://phab.mercurial-scm.org/D1075
2017-10-14 14:07:39 -04:00
Denis Laxalde
6c2c086e11 tersestatus: rework dirnode and tersedir docstrings
Follow-up on refactorings 6a96abee0045 and b8c13fc92233 of the original
changeset 8c58ee1e5fa4 by updating the docstrings of dirnode class and tersedir
function:

* rewrite dirnode.iterfilepaths()'s docstring (the method got
  renamed and reimplemented in b8c13fc92233);
* simplify and update dirnode.tersewalk() to remove reference to 'self' and
  'tersedict';
* use the imperative form of verbs in the first sentence of all docstrings.

Differential Revision: https://phab.mercurial-scm.org/D1072
2017-10-14 13:33:37 +02:00
Augie Fackler
714a44cc5e bitmanipulation: reformat with clang-format
Mostly un-wrapping over-wrapped definitions.

Differential Revision: https://phab.mercurial-scm.org/D1069
2017-10-04 10:52:50 -04:00
Augie Fackler
a67386352a python3: use our bytes-only version of cgi.escape everywhere
As suggested by Yuya in D965.

Differential Revision: https://phab.mercurial-scm.org/D1067
2017-10-05 14:16:20 -04:00
Augie Fackler
5167a44c70 url: add cgi.escape equivalent for bytestrings
This seems like a sensible enough place to put it.

Differential Revision: https://phab.mercurial-scm.org/D1066
2017-10-14 02:57:26 -04:00
Augie Fackler
a4bc1fe43c python3: move from using func_name to __name__
Previously reviewed as D964, but required some fixups and therefore
seems to need a new revision.

Differential Revision: https://phab.mercurial-scm.org/D1065
2017-10-05 14:15:05 -04: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
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
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