[PATCH 4 of 4 stable] PROOF OF CONCEPT: introduce lock validation

Christian Ebert blacktrash at gmx.net
Sun May 13 18:06:09 CDT 2012


* Mads Kiilerich on Saturday, May 12, 2012 at 20:37:46 +0200
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1326326392 -3600
> # Node ID 715dc5d131f5d690b32925a50a80ded2bb4b8609
> # Parent  4a112c51f224358f5c269b06d6ee82f43b6c9133
> PROOF OF CONCEPT: introduce 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.
> 
> diff --git a/hgext/keyword.py b/hgext/keyword.py
> --- a/hgext/keyword.py
> +++ b/hgext/keyword.py
> @@ -436,7 +436,11 @@
>     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()

Are you sure this is needed? I can't think of a situation where
the temporary kwdemo repo suffers from concurrent write access.
otoh, better safe than sorry.

c
-- 
Die Wolke Wolfgang
Eine Kindergeschichte mit Bildern. Von Michael Weber.
Das Buch   -->> http://www.blacktrash.org/baustellen#wolkewolfgang
Online     -->> http://www.blacktrash.org/wolkewolfgang


More information about the Mercurial-devel mailing list