dispatch: show a short error message when invalid global option given
Similar reasoning as the previous patch.
Differential Revision: https://phab.mercurial-scm.org/D4025
dispatch: don't show list of commands on bogus command
If a command is ambiguous, you get this:
$ hg ve
hg: command 've' is ambiguous:
verify version
[255]
If you typo a command, you get this:
$ hg comit
hg: unknown command 'comit'
(did you mean one of commit, incoming, mycommit?)
[255]
But if you completely mistype a command so it no longer looks like any
existing commands, you get a full list of commands. That might be
useful the first time you use Mercurial, but after that it's probably
more annoying than help, especially if you have the pager enabled and
have a short terminal. Let's instead give a short hint telling the
user to run `hg help` for more help.
Differential Revision: https://phab.mercurial-scm.org/D4024
histedit: avoid repeating name of state file in a few places
We can depend on the state object instead.
Differential Revision: https://phab.mercurial-scm.org/D4006
py3: stop rewriting xrange() to pycompat.xrange()
We now require the use of pycompat.xrange() in source.
One less feature in the module importer gets us one step closer
to Python 3 native source code.
Differential Revision: https://phab.mercurial-scm.org/D4034
check-code: ban use of bare xrange()
We want everyone to use pycompat.xrange().
Differential Revision: https://phab.mercurial-scm.org/D4033
global: use pycompat.xrange()
On Python 3, our module importer automatically rewrites xrange()
to pycompat.xrange().
We want to move away from the custom importer on Python 3.
This commit converts all instances of xrange() to use
pycompat.xrange().
Differential Revision: https://phab.mercurial-scm.org/D4032
pycompat: add xrange alias for Python 2
We assign xrange on Python 3 but not Python 2. Adding the missing
symbol on Python 2 allows us to use `pycompat.xrange` to get a
generator range function.
Differential Revision: https://phab.mercurial-scm.org/D4031
manifest: persist the manifestfulltext cache
Reconstructing the manifest from the revlog takes time, so much so that there
already is a LRU cache to avoid having to load a manifest multiple times.
This patch persists that LRU cache in the .hg/cache directory, so we can re-use
this cache across hg commands. Commit benchmark (run on Macos 10.13 on a
2017-model Macbook Pro with Core i7 2.9GHz and flash drive), testing without
and with patch run 5 times, baseline is r
2a227782e754:
* committing to an existing file, against the mozilla-central repository.
Baseline real time average 1.9692, with patch 1.3786.
A new debugcommand "hg debugmanifestfulltextcache" lets you inspect the cache,
clear it, or add specific manifest nodeids to it. When calling
repo.updatecaches(), the manifest(s) for the working copy parents are added to
the cache.
The hg perfmanifest command has an additional --clear-disk switch to clear this
cache when testing manifest loading performance.
Using this command to test performance on the firefox repository for revision
f947d902ed91, whose manifest has a delta chain length of 60540, we see:
$ hg perfmanifest
f947d902ed91 --clear-disk
! wall 0.972253 comb 0.970000 user 0.850000 sys 0.120000 (best of 10)
$ hg debugmanifestfulltextcache -a `hg log --debug -r
f947d902ed91 | grep manifest | cut -d: -f3`
Cache contains 1 manifest entries, in order of most to least recent:
id:
0294517df4aad07c70701db43bc7ff24c3ce7dbc, size 25.6 MB
Total cache data size 25.6 MB, on-disk 0 bytes
$ hg perfmanifest
f947d902ed91
! wall 0.036748 comb 0.040000 user 0.020000 sys 0.020000 (best of 100)
Worst-case scenario: a manifest text loaded from a single delta; in the firefox
repository manifest node
9a1246ff762e is the chain base for the manifest
attached to revision
f947d902ed91. Loading this from a full cache file is just
as fast as without the cache; the extra node ids ensure a big full cache:
$ for node in
9a1246ff762e 1a1922c14a3e 54a31d11a36a 0294517df4aa; do
> hgd debugmanifestfulltextcache -a $node > /dev/null
> done
$ hgd perfmanifest -m
9a1246ff762e
! wall 0.077513 comb 0.080000 user 0.030000 sys 0.050000 (best of 100)
$ hgd perfmanifest -m
9a1246ff762e --clear-disk
! wall 0.078547 comb 0.080000 user 0.070000 sys 0.010000 (best of 100)