Commit Graph

16 Commits

Author SHA1 Message Date
Boris Feld
6fefecff91 lock: allow to configure when the lock messages are displayed
We add a new 'ui.timeout.warn' config to set a grace period before we display
lock related warning:

    waiting for lock on PATH held by PROCESS

The config is based on 'ui.timeout' and expresses a number of seconds before
the warning is displayed. Negative values disable the warning altogether.

The messages go to the debug output to help people trouble-shooting deadlocks.
2017-11-29 20:39:59 -05:00
Pulkit Goyal
b4347ea80f py3: make sure commands name are bytes in tests 2017-06-25 08:20:05 +05:30
Yuya Nishihara
3e663dde68 registrar: move cmdutil.command to registrar module (API)
cmdutil.command wasn't a member of the registrar framework only for a
historical reason. Let's make that happen. This patch keeps cmdutil.command
as an alias for extension compatibility.
2016-01-09 23:07:20 +09:00
Mark Ignacio
1ca1a521d4 lock: show more detail for new-style locks in lock waiting message (issue4752)
Improve the lock waiting warning message by explicitly saying that a host and
process are holding the lock. This nudges confused new users in the direction
of investigating the other process instead of removing the lock.
2016-08-30 09:25:00 -07:00
timeless
6a51ec0928 tests: test-lock-badness.t message could come later
I got this on gcc112:
@@ -58,8 +58,8 @@
   $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
   $ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf"
   waiting for lock on working directory of b held by '*:*' (glob)
-  got lock after ? seconds (glob)
   $ wait
+  got lock after 1 seconds
   $ cat stdout
   adding b
1970-01-01 00:00:00 +00:00
Pierre-Yves David
30913031d4 error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.

For great justice.
2015-10-08 12:55:45 -07:00
Pierre-Yves David
4cfd7f9399 update: wlock the repo for the whole 'hg update' command
The update command is touching the repository and should lock it for
the length of its operations. Equally importantly, it should lock the
repository when it is writing bookmarks. It wasn't doing so until now,
leaving doors open for all kinds of drunk beaver parties.

This results in some minor tests changes, and the fixing of a couple
of bugs from race conditions.

Code does not receive any changes beside extra indentation.
2015-08-11 16:26:12 -07:00
Siddharth Agarwal
146e346b87 lock: while releasing, unlink lockfile even if the release function throws
Consider a hypothetical bug in the release function that causes it to raise an
exception. Also consider the bisect command, which saves its state in a finally
clause. Saving the state requires acquiring the wlock.

If we don't unlink the lockfile when the exception is thrown, we'll try to
acquire the wlock again. We're going to try and acquire a lock again while our
old lockfile is on disk. The PID on disk is our own, and of course we're still
running, so we won't take over the lock. Hence we'll be stuck waiting for a
lock that we left behind ourselves.

To avoid this, always unlink the lockfile. This preserves the invariant that
self.held > 0 is equivalent to the lockfile existing on disk.
2014-10-16 19:15:51 -07:00
Matt Mackall
241d2dc08e tests: change some #ifs to #requires 2014-08-06 11:53:08 -05:00
Pierre-Yves David
69ae281a65 localrepo: add unbundle support
Localrepo now supports the unbundle method of pushing changegroups. We
plan to use the unbundle call for bundle2 so it is important that all
peers supports it. The `peer.unbundle` and `peer.addchangegroup` code
path have small difference so cause some test output changes. None of those
changes seems problematic.
2014-04-04 17:50:44 -07:00
Simon Heimberg
cd665814c5 tests: match time by a glob to fix intermittent failures of test-lock-badness.t
Sometimes the lock was a bit slower and took 2 seconds. Do not fail the test by
this.
The glob ? matches from 0 to 9 seconds, which should be enough safety.
2014-03-05 14:03:08 +01:00
Mads Kiilerich
2e26bbb4c8 localrepo: give a sigh of relief when getting lock after waiting for it
A message like this was sometimes shown when pushing:
  remote: waiting for lock on repository foo held by 'mercurial:20858'
That could scare users, making them wonder whether the push actually succeeded.

To mitigate that fear, issue an additional "warning" such as:
  got lock after 2 seconds

The return value from lock.lock.lock() was unused - instead we return the
delay.

This also adds the first test coverage for waiting for locks.
2014-02-06 01:55:09 +01:00
Matt Mackall
280eec0087 tests: skip tests that require not having root (issue4089)
This adds a new root hghave to test against. Almost all of these are a
subset of unix-permissions, but that is also used for checking exec
bit handling.
2013-11-14 18:07:43 -06:00
Mads Kiilerich
72ebeacea3 tests: use 'hghave unix-permissions' for tests that really use chmod
chmod of helper scripts is not included.

tests that exercise the x bit in the file system uses 'hghave execbit'.
2011-11-07 03:14:55 +01:00
Matt Mackall
08439e0f2d tests: add exit codes to unified tests 2010-09-16 17:51:32 -05:00
Adrian Buehlmann
e3a15e43a7 tests: unify test-lock-badness 2010-08-26 12:41:00 +02:00