[PATCH 2 of 3 fyi] hack: lock validation
Christian Ebert
blacktrash at gmx.net
Sun Nov 17 18:20:49 UTC 2013
* Mads Kiilerich on Sunday, November 17, 2013 at 12:53:58 -0500
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1326326392 -3600
> # Thu Jan 12 00:59:52 2012 +0100
> # Branch stable
> # Node ID ca1828f0c90d81978daa555fdcdbe841d4fe70b3
> # Parent 41d9e7b97f3ced21c0665253a6495165f58a2730
> hack: lock validation
>
> Instrumenting critical places with these checks can help verifying compliance
> with the locking strategy described on
> http://mercurial.selenic.com/wiki/LockingDesign.
>
> Occasionally running the test suite with this patch might catch some locking
> errors, but the checking as it is is probably too intrusive for inclusion in
> core Mercurial.
>
> Essential parts of this patch had conflicts and has been left out. It should be
> verified that the checks are reasonable complete.
>
> A part of this patch now lives (and dies) in contrib/lock-checker.py .
>
> diff --git a/hgext/keyword.py b/hgext/keyword.py
> --- a/hgext/keyword.py
> +++ b/hgext/keyword.py
> @@ -439,7 +439,11 @@ def demo(ui, repo, *args, **opts):
> repo[None].add([fn])
> ui.note(_('\nkeywords written to %s:\n') % fn)
> ui.note(keywords)
> - repo.dirstate.setbranch('demobranch')
> + wlock = repo.wlock()
> + try:
> + repo.dirstate.setbranch('demobranch')
> + finally:
> + wlock.release()
> for name, cmd in ui.configitems('hooks'):
> if name.split('.', 1)[0].find('commit') > -1:
> repo.ui.setconfig('hooks', name, '')
imho the above is unneeded, as this happens in a temporary demo
repo with no precious data, it's part of hg kwdemo and never used
outside that particular command.
--
\black\trash movie _SAME TIME SAME PLACE_
New York, in the summer of 2001
--->> http://www.blacktrash.org/underdogma/stsp.php
More information about the Mercurial-devel
mailing list