A Scalable, User-Friendly Source Control System.
Go to file
Kostia Balytskyi 46bc847b23 windows: improve lock file logic
Summary:
Quick experimentation shows that existing lock file logic is not enoug for
frequently run and killed Mercurial processes (Mercurial run by tools, such as
Nuclide is an example of such scenario)

I wrote the following two files:
```
c:\Code\tries\pythontries λ cat lockcreator.py
import os, random

def makelock(info, pathname):
    ld = os.open(pathname, os.O_CREAT | os.O_WRONLY | os.O_EXCL)
    os.write(ld, info)
    # os.fsync(ld)
    os.close(ld)

name = os.path.join('locks', 'lock.pid' + str(os.getpid()) + ".rand" + str(random.randint(0, 10000)))
makelock('contents', name)
```
and
```
c:\Code\tries\pythontries λ cat lockracer.py
import os, subprocess, time, random

for i in xrange(10000):
    proc = subprocess.Popen('python lockcreator.py')
    time.sleep(0.001*random.randint(0, 500))
    proc.terminate()

```

After runnning `python lockracer.py`, I did `ls -l locks | grep "0 Apr"`, this way it showed all the 0-byte files created in April. This shows a non-empty output. Uncommenting the `os.fsync` line does not help much.

Rewriting `lockcreator.py` to use temp lock file approach helps greatly.

Reviewed By: quark-zju

Differential Revision: D7653186

fbshipit-source-id: 48e9eeeca34075ea2ec78f3319491bcebc0e88c7
2018-04-17 17:42:26 -07:00
.cargo build: vendor in Rust dependencies 2018-01-09 17:48:32 -08:00
contrib xdiff: backport upstream changes 2018-04-13 21:51:48 -07:00
distutils_rust setup: build rust extensions in a shared directory 2018-04-13 21:51:49 -07:00
doc flake8: enable F821 check 2018-04-13 21:51:09 -07:00
hgdemandimport extensions: forbid "foo=" from importing foreign mercurial modules 2018-01-09 17:06:09 -08:00
hgext debugshell: assign m to be mercurial 2018-04-17 16:35:25 -07:00
hgext3rd extensions: also search for extension in the 'hgext3rd' package 2016-03-11 10:30:08 +00:00
hgsubversion flake8: resolve some F checks 2018-04-13 21:51:09 -07:00
i18n flake8: enable some E checks 2018-04-13 21:51:09 -07:00
lib hg: fix test-checks broken in windows treemanifest stack 2018-04-13 21:51:50 -07:00
lz4revlog lz4revlog: internalize extension and test 2018-01-03 07:15:33 -08:00
mercurial windows: improve lock file logic 2018-04-17 17:42:26 -07:00
tests setup: drop install_requires 2018-04-17 16:35:25 -07:00
.clang-format clang-format: configuration for the clang-format source formatter 2015-01-24 17:04:25 -05:00
.editorconfig mercurial: add editorconfig 2016-04-05 18:10:33 +01:00
.flake8 flake8: enable some E checks 2018-04-13 21:51:09 -07:00
.gitignore hg: actually run the tests in fb/tests 2018-04-13 21:51:54 -07:00
.hg-vendored-crates build: vendor in Rust dependencies 2018-01-09 17:48:32 -08: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
hg dispatch: move initialization of sys.std* files 2017-10-02 07:18:24 +01: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 makefile: make make local build re2 2018-04-17 16:35:25 -07:00
README.rst doc: rename README to README.rst 2017-09-26 08:37:17 +02:00
setup.py setup: add --re2-src config option to build_ext command 2018-04-17 16:35:25 -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.