A Scalable, User-Friendly Source Control System.
Go to file
Matt Glazar 9b88f1e59b Fix slow rebase for commits which move files
Summary:
When rebasing or showing a diff for a commit which moved files, remotefilectx.ancestors (called by _tracefile) calculates the linkrev for each ancestor. Sometimes [1], this is a disaster:

* remotefilectx._linkrev executes its slow path and scans the change log.
* For each entry in the change log, remotefilectx._linkrev downloads trees if needed.
* Hg downloads trees one-by-one (as of D15964145).

remotefilectx.ancestors is only calculating linkrevs so it can sort the ancestors topologically. _tracefile only needs the ancestors to be ordered topologically, not by linkrev. remotefilectx.ancestors's calls to remotefilectx._linkrev are redundant.

Optimize _tracefile's use of remotefilectx.ancestors: order remotefilectx objects topologically (breadth-first) without sorting by linkrev. Create a new function for this purpose (topological_ancestors) to avoid possibly breaking other callers of remotefilectx.ancestors. As a side effect, make this new function return remotefilectx objects lazily, similar to the filectx.ancestors function.

On my machine, with warm caches, this speeds up 'hg diff -c' and 'hg rebase' for a modestly-sized commit. 'hg diff -c' takes 0.64 seconds, down from 65.6 seconds.

[1] Hypothesis: After 'hg amend', 'hg bundle' packages linkrevs which refer to the pre-amend commit (which is not serialized into the bundle) rather than the post-amend commit. 'hg unbundle' thus creates linkrevs referring to a missing commit.

Reviewed By: DurhamG

Differential Revision: D16297426

fbshipit-source-id: 407597d5e36fc06b33719c28f5ea5052e01dc7a3
2019-07-19 12:35:22 -07:00
contrib RFC: hg: make zsh completion to return list of draft commits 2019-07-18 22:26:01 -07:00
distutils_rust entrypoint: introduce buck-buildable hg.rust 2019-06-17 11:34:08 -07:00
doc doc: remove unused doc build step 2019-05-14 15:09:42 -07:00
edenscm Fix slow rebase for commits which move files 2019-07-19 12:35:22 -07:00
edenscmnative setup: move native extensions to edenscmnative 2019-06-19 17:55:49 -07:00
exec Apply rustfmt to all rust files 2019-07-10 20:18:48 -07:00
i18n ui: add labelled prefixes to ui.write 2019-05-09 06:55:11 -07:00
lib blackbox: buffer logs before initialization 2019-07-18 15:11:57 -07:00
newdoc newdoc: revise WritingExtensions 2019-03-14 11:51:39 -07:00
slides slides: recompile with newer tex toolchain 2019-04-18 13:50:03 -07:00
tests Fix slow rebase for commits which move files 2019-07-19 12:35:22 -07:00
.editorconfig move scm/hg/.clang-format to scm/hg/mercurial/ 2018-05-25 14:35:51 -07:00
.flake8 codemod: join the auto-formatter party 2018-05-25 22:17:29 -07:00
.gitignore setup: move native extensions to edenscmnative 2019-06-19 17:55:49 -07:00
.hgsigs Added signature for changeset f51ae48a3fd9 2017-12-01 13:49:47 -06:00
.jshintrc hgweb: add .jshintrc with some basic rules 2017-11-22 22:18:06 +08:00
CONTRIBUTING contributing: add new file with a pointer to the wiki 2016-10-08 10:39:00 -04:00
CONTRIBUTORS Add note to CONTRIBUTORS file 2007-11-07 21:10:30 -06:00
COPYING COPYING: refresh with current address from fsf.org 2011-06-02 11:17:02 -05:00
gen_version.py generate __version__.py during the buck build 2018-06-25 15:52:25 -07:00
hgeditor spelling: trivial spell checking 2015-10-17 00:58:46 +02:00
hgweb.cgi codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
Makefile windows: switch to the new Python runtime 2019-06-24 08:34:23 -07:00
README.rst doc: rename README to README.rst 2017-09-26 08:37:17 +02:00
setup.py setup: rename IPython.zip to edenscmdeps.zip 2019-07-17 17:35:52 -07:00

Mercurial
=========

Mercurial is a fast, easy to use, distributed revision control tool
for software developers.

Basic install::

 $ make            # see install targets
 $ make install    # do a system-wide install
 $ hg debuginstall # sanity-check setup
 $ hg              # see help

Running without installing::

 $ make local      # build for inplace usage
 $ ./hg --version  # should show the latest version

See https://mercurial-scm.org/ for detailed installation
instructions, platform-specific notes, and Mercurial user information.