Commit Graph

13 Commits

Author SHA1 Message Date
timeless
3502e556ef util: enable getpid to be replaced
This will enable tests to write stable process ids.
2016-02-03 09:11:22 +00:00
Siddharth Agarwal
b91b05d624 localrepo: prevent wlock from being inherited when a transaction is running
Review feedback from Pierre-Yves David. A separate line of work is working to
ensure that dirstate writes are written to a separate 'pending' file while a
transaction is active. Lock inheritance currently conflicts with that, so dodge
the issue by simply preventing inheritance while a transaction is running.

Custom merge drivers aren't going to run inside a transaction, so this doesn't
affect that.
2015-10-06 13:19:05 -07:00
Siddharth Agarwal
eb9c8405ac lock: add a way to prevent locks from being inherited
We want to prevent locks from being inherited sometimes (e.g. when there's a
currently running transaction, which will break a lot of assumptions we're
making in here.)
2015-10-06 13:13:31 -07:00
Siddharth Agarwal
fb3839770e lock.release: don't call postrelease functions for inherited locks
Review feedback from Pierre-Yves David. The postrelease functions typically
assume the lock is not held at all.
2015-10-04 20:04:44 -07:00
Siddharth Agarwal
536de184ae lock: turn prepinherit/reacquire into a single context manager
Review feedback from Pierre-Yves David. This makes the overall code cleaner and
less error-prone, and makes a previously explicitly checked error state
impossible.
2015-10-04 20:02:50 -07:00
Siddharth Agarwal
4a04cef0a1 lock: recognize parent locks while acquiring
This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances. This patch enables the logic introduced in previous
patches.
2015-09-24 22:07:55 -07:00
Siddharth Agarwal
e60aaeccf1 test-lock.py: fix testing for forks
The earlier test worked only because the held count went up to 2, so the first
release brought it down to 1. Making a copy of the lock fixes that issue.
2015-09-24 22:00:51 -07:00
Siddharth Agarwal
1d157c4b16 test-lock.py: allow PID to be changed in test state
This will be used in upcoming patches to create locks that appear as if they're
being created by child processes.
2015-09-24 20:40:00 -07:00
Siddharth Agarwal
e006a50c9b test-lock.py: add a lock wrapper that allows faking the PID
This will be used in upcoming patches to create locks that appear as if they're
being created by child processes.
2015-09-24 20:22:59 -07:00
Siddharth Agarwal
14584f8c1d test-lock.py: move temp dir generation to testcase
In upcoming patches we'll want to create multiple test state objects with a
common test directory.
2015-09-24 19:52:34 -07:00
Siddharth Agarwal
abec122d89 test-lock.py: copy-edit assertions about file existing
Before: expected lock to exists but actually did not exists
After:  expected lock to exist but actually did not exist
2015-09-24 17:33:13 -07:00
Siddharth Agarwal
0edaba580a lock: move acquirefn call to inside the lock
We're going to need to call it again as part of reinitialization after a
subprocess inherits the lock.
2015-09-22 14:09:42 -07:00
Siddharth Agarwal
3896b66e0f tests: add unit tests for locking code
We're going to make significant changes to lock behavior soon.
2015-09-17 15:38:00 -07:00