A Scalable, User-Friendly Source Control System.
Go to file
Jun Wu 928dd2dd44 progress: rewrite suspend to make __exit__ atomic
Summary:
The less Python instructions in the `__exit__` or `finally` block, the less
risk we have with SIGINT handling.

The old `ui._write` code path has 8 Python instructions before reaching
`release()`, `suspend.__exit__` has more.

```
Disassembly of ui._write, finally block:
844         130 LOAD_FAST                3 (suspended)
            133 POP_JUMP_IF_FALSE      149

845         136 LOAD_GLOBAL              0 (progress)
            139 LOAD_ATTR               11 (_suspendfinish)
            142 CALL_FUNCTION            0
            145 POP_TOP
            146 JUMP_FORWARD             0 (to 149)
        >>  149 END_FINALLY

Disassembly of progress._suspendfinish:
565           0 LOAD_GLOBAL              0 (_engine)
              3 LOAD_ATTR                1 (_cond)
              6 LOAD_ATTR                2 (release)
              9 CALL_FUNCTION            0
             12 POP_TOP
             13 LOAD_CONST               0 (None)
             16 RETURN_VALUE

Disassembly of progress.suspend.__exit__:
576           0 LOAD_FAST                0 (self)
              3 LOAD_ATTR                0 (_suspended)
              6 POP_JUMP_IF_FALSE       19

577           9 LOAD_GLOBAL              1 (_suspendfinish)
             12 CALL_FUNCTION            0
             15 POP_TOP
             16 JUMP_FORWARD             0 (to 19)
        >>   19 LOAD_CONST               0 (None)
             22 RETURN_VALUE
```

This diff changes it so `__exit__` is backed directly by the `Condition`
implementation, minimizing the Python instructions. In case `Condition`
is backed by the native Rust implementation, it is atomic and cannot
be interrupted by Python exceptions.

`util.nullcontextmanager` is rewritten to be more efficient.

Reviewed By: markbt

Differential Revision: D10843398

fbshipit-source-id: ba5f5d47b5b9948324a228778e3362531da87107
2018-10-25 13:12:00 -07:00
contrib progress: use Condition backed by Rust 2018-10-25 13:12:00 -07:00
distutils_rust distutils_rust: add support for features 2018-10-12 14:55:09 -07:00
doc amend: replace with the fbamend extension 2018-10-11 06:59:23 -07:00
exec hgpython: rename hgenv to be buildenv 2018-10-12 14:55:09 -07:00
hgdemandimport hg.rust: add py logic to support running from a zipped stdlib 2018-10-12 14:55:09 -07:00
hgext fsmonitor: bump default timeout to 10 2018-10-25 13:08:46 -07:00
hgext3rd codemod: join the auto-formatter party 2018-05-25 22:17:29 -07:00
i18n help: improve some help messages 2018-10-15 09:37:19 -07:00
lib histpack: sort history entries before writing them 2018-10-23 17:16:01 -07:00
mercurial progress: rewrite suspend to make __exit__ atomic 2018-10-25 13:12:00 -07:00
newdoc doc: add QuickStart 2018-10-24 18:59:14 -07:00
slides slides: add indexedlog slide 2018-08-13 15:06:58 -07:00
tests run-tests: use Rust RLock implemenation if possible 2018-10-25 13:12:00 -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 make: improve windows make logic 2018-10-12 14:55:09 -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
.watchmanconfig watchman: add an empty .watchmanconfig 2018-04-13 21:50:54 -07: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
hg hg: move to more fine-grained python execution from the binary 2018-08-30 04:42:11 -07:00
hgeditor spelling: trivial spell checking 2015-10-17 00:58:46 +02:00
hgweb.cgi urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
Makefile build: cleanup old windows build code 2018-10-16 08:37:23 -07:00
README.rst doc: rename README to README.rst 2017-09-26 08:37:17 +02:00
setup.py rust: reinvent Python's threading.Condition 2018-10-25 13:12:00 -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.