Commit Graph

20048 Commits

Author SHA1 Message Date
Kevin Bullock
d82cceaa42 merge with stable 2017-11-03 10:32:38 -05:00
Matt Harbison
325a0abc6e pathutil: use util.pathto() to calculate relative cwd in canonpath()
os.path.relpath() exploded if the 'root' and 'cwd' directories had different
drive letters.  I noticed this in TortoiseHg when typing a fileset into the
filter, and it kept complaining until the closing '()' was typed.  This was
reproducible on the command line with:

  $ cd /d
  $ hg -R /c/Users/Matt/Projects/hg files 'set:e'
  Traceback (most recent call last):
  ...
  File "mercurial\pathutil.pyc", line 182, in canonpath
  File "ntpath.pyc", line 529, in relpath
  ValueError: path is on drive c:, start on drive d:
2017-11-02 20:35:31 -04:00
Kevin Bullock
8b1854807c internals: copy-edit "register" -> "registrar" in configitem docs 2017-11-01 13:24:08 -05:00
Matt Harbison
ba66d4513f help: minor copy editing for grammar 2017-10-31 23:09:29 -04:00
Yuya Nishihara
21161a9bda configitems: relax warning about unwanted default value
The original condition was a bit harsh for extension authors since third-party
extensions need to preserve compatibility with older Mercurial versions, where
no defaults would be loaded from the configtable. So let's silence the warning
if the given default value matches, which should be harmless.
2017-10-31 22:37:30 +09:00
Kostia Balytskyi
b244c1e330 filemerge: pass a default value to _toolstr (issue5718)
After a refactoring, _toolstr stopped having default="" as one of it's args,
therefore when called without a default it returns None and not "". This causes
concatenation to fail.
2017-10-26 11:07:06 -07:00
Yuya Nishihara
956c057ed5 statichttprepo: do not use platform path separator to build a URL
It wouldn't work between Windows client and Unix server.
2017-10-28 17:23:52 +09:00
Siddharth Agarwal
2d9d1fcc19 merge: disable path conflict checking by default (issue5716)
We shouldn't ship a severe perf regression in hg update for 4.4.

Differential Revision: https://phab.mercurial-scm.org/D1223
2017-10-24 11:15:30 -07:00
Siddharth Agarwal
1fe04b20a0 merge: add a config option to disable path conflict checking
We've found a severe perf regression in `hg update` caused by the path conflict
checking code. The next patch will disable this by default.

Differential Revision: https://phab.mercurial-scm.org/D1222
2017-10-24 11:14:38 -07:00
Yuya Nishihara
57fc1b2b62 patch: improve heuristics to not take the word "diff" as header (issue1879)
The word "diff" is likely to appear in a commit message. Let's make it less
likely by requiring "diff -" for "diff -r" or "diff --git".
2017-10-21 16:50:57 +09:00
Mark Thomas
1d4d162882 dirstate: clean up when restoring identical backups
When a dirstate backup is restored, it is possible that no actual changes to
the dirstate have been made.  In this case, the backup is still a hardlink
to the original dirstate.

Unfortunately, `os.rename` silently fails (nothing happens, and no error
occurs) when `src` and `dst` are hardlinks to the same file.  As a result,
the backup is left lying around.  Over time, these files accumulate.

When restoring dirstate backups, check if the backup and the dirstate are
the same file, and if so, just delete the backup.

Differential Revision: https://phab.mercurial-scm.org/D1201
2017-10-20 05:53:35 -07:00
Durham Goode
35f758a851 dirstate: remove excess attribute lookups for dirstate.status (issue5714)
A recent refactor added a layer of abstraction to the dirstate which makes doing
things like 'foo in dirstate' now require some extra Python attribute lookups.
This is causing a 100ms slow down in hg status for mozilla-central.

The fix is to hoist the inner dict's functions onto the main class once the lazy
loading it complete, as well as store the actual functions before doing the
status loop (as is done for other such functions).

In my testing, it seems to address the performance regression, but we'll
need to see the perf run results to know for sure.

Differential Revision: https://phab.mercurial-scm.org/D1257
2017-10-28 12:35:54 -07:00
Durham Goode
c83eaaa0f1 dirstate: avoid reading the map when possible (issue5713) (issue5717)
Before the recent refactor, we would not load the entire map until it was
accessed. As part of the refactor, that got lost and even just trying to load
the dirstate parents would load the whole map. This caused a perf regression
(issue5713) and a regression with static http serving (issue5717).

Making it lazy loaded again fixes both.

Differential Revision: https://phab.mercurial-scm.org/D1253
2017-10-26 16:15:36 -07:00
Durham Goode
6a075fddcc dirstate: move clear onto dirstatemap class
A future diff will move the lazy loading aspect of dirstate to the dirstatemap
class. This means it requires a slightly different strategy of clearing than
just reinstantiating the object (since just reinstantiating the object will
lazily load the on disk data again later instead of remaining permanently
empty).

So let's give it it's own clear function.

Differential Revision: https://phab.mercurial-scm.org/D1252
2017-10-26 16:15:31 -07:00
Boris Feld
2d8cec51a9 internal-doc: document the config register mechanism
This explains the various usage and feature of the config register introduced
in Mercurial 4.3 and 4.4.
2017-10-27 18:19:07 +02:00
Boris Feld
51339acb82 help: clarify the pre-txnclose-phase documentation
Gregory Szorc requested some clarification.
2017-10-27 21:43:22 +02:00
Boris Feld
33f349a991 internal-doc: document the 'phases' parameters to 'getbundle'
The getbundle wireprotocol method has some extended documentation. We update it
with the next parameters introduced for binary phases.
2017-10-27 21:35:34 +02:00
Matt Harbison
258062fa5b status: update the help to indicate that clean files are not normally tersed
The same applies to '?' if --quiet is used (or any of the other states if some
of -marduic is specified), but I couldn't figure out how to express that
clearly.
2017-10-28 00:00:05 -04:00
Matt Harbison
9eb4def389 terse: split on repo separator instead of os.sep (issue5715)
The paths being processed are from scmutil.status, and therefore normalized to
'/' separators.
2017-10-27 23:48:38 -04:00
Yuya Nishihara
73e9f96212 statichttprepo: prevent loading dirstate over HTTP on node lookup (issue5717)
This seems a bit hacky, but works well. There should be no reason that
static-http repo had to load dirstate.

Initially I tried to proxy os.stat() call through vfs so that statichttpvfs
could hook it, but there wasn't a good error value which the statichttpvfs
could return to get around the util.filestat issue.
2017-10-25 21:58:03 +09:00
Yuya Nishihara
86972fbe07 server: drop executable bit from daemon log file
The logfile option was unused, so it was okay until now.
2017-10-25 21:20:01 +09:00
muxator
aaf12eb558 commands: be more uniform in an "hg update" error message
"can only specify one of -C/--clean, -c/--check, or -m/merge"
becomes
"can only specify one of -C/--clean, -c/--check, or -m/--merge"
2017-10-23 22:45:24 +02:00
muxator
571ba67b50 update: mention long options explicitly in description of merge.update()
The short options "-c" and "-C" may be confusing for a novice reading the
documentation. Let's try to be more explicit, also mentioning the equivalent
long options ("--check" and "--clean") in the comments.
2017-10-04 23:22:34 +02:00
Yuya Nishihara
9e02f75b4c registrar: host "dynamicdefault" constant by configitem object
This is the common pattern seen in the other registrar classes.
2017-10-21 13:13:20 +09:00
Yuya Nishihara
74c1bd2363 configitems: register 'ui.editor' 2017-10-21 13:04:58 +09:00
Joe Blaylock
f9b24c83ac help: fix typo in hg merge documentation 2017-10-20 14:15:46 -07:00
Yuya Nishihara
1d02a603e8 help: do not abort topicmatch() because of unimportable extensions
This is alternative workaround to D1198, originally spotted by the earlier
version of the releasenotes extension.
2017-08-05 23:15:37 +09:00
Yuya Nishihara
6e8c1d0f1a configitems: register 'email.to' and 'patchbomb.to' 2017-10-20 22:25:09 +09:00
Boris Feld
87151ab0b0 exchange: propagate the subfunctions return
The parts generator can return a callback to handle server reply. We should
propagate the return for correctness.
2017-10-19 21:50:14 +02:00
Denis Laxalde
6a72a6393c log: add an assertion about fctx not being None in patch.diff()
As noted in the comment, this should not happen as removed files (the cause of
fctx2 being None) are caught earlier.
2017-10-19 15:06:33 +02:00
Denis Laxalde
daa0a6c266 log: handle removed files with --line-range patterns
I.e. abort when the pattern corresponds to a removed file, as done with bare
file patterns.
2017-10-19 14:55:10 +02:00
Denis Laxalde
40359bfd01 log: disable bare file patterns with --line-range
Currently, specifying both a line-range pattern and a bare file pattern
results in an AND operation whereas we probably want an OR so that bare file
patterns are like a line-range pattern with all lines specified.

So, until this works as expected, we disable this.
2017-10-19 14:12:49 +02:00
Denis Laxalde
21cd66f96c log: switch to FROMLINE:TOLINE syntax for -L/--line-range
This is more consistent with the followlines() revset.
2017-10-19 12:37:26 +02:00
Denis Laxalde
7b3941db14 log: handle binary files in --line-range patterns
When a file is binary patch.trydiff() would yield None for 'hunkrange'. Handle
this case in the hunksfilter() callback.
Add tests with and without diff.git option as binary handling differs
depending on this option's value.
2017-10-18 19:00:33 +02:00
Boris Feld
bd26fb4ef0 config: also gather effect-flags on experimental.evolution
Effect-flags config was in flight while the previous evolve config renaming
was written. Now that both landed, gather effect-flags in
experimental.evolution like the others evolve-related configurations.

Differential Revision: https://phab.mercurial-scm.org/D1197
2017-10-19 17:50:20 +02:00
Boris Feld
b2b964dde1 obsfate: rename obsfate into obsolete in default mapfile
Like the previous patch, replace obsfate by obsolete in default mapfile.

Differential Revision: https://phab.mercurial-scm.org/D1190
2017-10-19 12:33:53 +02:00
Boris Feld
540b37e2a9 obsfate: rename obsfate into obsolete in changeset_printer
Yuja's comment on the original obsfate about how we would translate obsfate
and the recent discussions about exposing users to new concepts and names lead
have led me to think that 'obsfate' should be treated as internal jargon. End-
users should not be aware of obsfate, so we replace 'obsfate' by 'obsolete' in
changeset_printer.

It will be easier to understand for end-users, easier to translate and closer
to the original Evolve obsfate output.

I'm aware it's extremely late in the cycle but I think it's an UX improvement
for the end-users.

Differential Revision: https://phab.mercurial-scm.org/D1189
2017-10-19 12:32:42 +02:00
Paul Morelle
80d72dfb5f sparse-read: ignore trailing empty revs in each read chunk
An empty entry in the revlog may happen for two reasons:
- when the file is empty, and the revlog stores a snapshot;
- when there is a merge and both parents were identical.

`hg debugindex -m | awk '$3=="0"{print}' | wc -l` gives 1917 of such entries
in my clone of pypy, and 113 on my clone of mercurial.

These empty revision may be located at the end of a sparse chain, and in some
special cases may lead to read relatively large amounts of data for nothing.
2017-10-18 15:28:19 +02:00
Martin von Zweigbergk
745cf248e6 registrar: don't i18n ProgrammingError message
Differential Revision: https://phab.mercurial-scm.org/D1188
2017-10-18 22:10:08 -07:00
Martin von Zweigbergk
0975261d97 registrar: move "constant" possiblecmdtypes to class level
While at it, switch to set literal syntax.

Differential Revision: https://phab.mercurial-scm.org/D1187
2017-10-18 22:07:53 -07:00
Augie Fackler
28d451ef21 cmdutil: fix status tersing on Python 3
Differential Revision: https://phab.mercurial-scm.org/D1183
2017-10-18 18:30:02 -04:00
Augie Fackler
a0c006361b configitems: make all regular expressions bytes and not native str
Fixes many tests on Python 3.

Differential Revision: https://phab.mercurial-scm.org/D1181
2017-10-18 18:29:00 -04:00
Jun Wu
c0323e0c94 show: move configitems to core
chgserver.py is also checking the config and will get:

  devel-warn: accessing unregistered config item:
  'commands.show.aliasprefix' at:
  mercurial/chgserver.py:109

if the config is not registered.

Differential Revision: https://phab.mercurial-scm.org/D1178
2017-10-18 15:05:03 -07:00
Jun Wu
d0d741d8a7 chgserver: do not treat HG as sensitive environ when CHGHG is set
When `$CHGHG` is set, `$HG` is ignored by the chg client. Removing it from
chg's sensitive environment list would avoid starting up servers
unnecessarily when `$CHGHG` is the same while `$HG` is different.

Differential Revision: https://phab.mercurial-scm.org/D1177
2017-10-18 14:55:39 -07:00
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