Patchwork keyword: wlock while setting branch in kwdemo

login
register
mail settings
Submitter Christian Ebert
Date Nov. 20, 2013, 12:57 p.m.
Message ID <45d15012f02b332cdc16.1384952261@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/3071/
State Accepted
Commit 7ad2ae7792ad2072c8a14c5c6c8df01316cacd66
Headers show

Comments

Christian Ebert - Nov. 20, 2013, 12:57 p.m.
# HG changeset patch
# User Christian Ebert <blacktrash@gmx.net>
# Date 1384952108 0
#      Wed Nov 20 12:55:08 2013 +0000
# Node ID 45d15012f02b332cdc16f00a894b1ec29926633d
# Parent  6d4fda48b4e3710cfc2161f676adb46c424079d3
keyword: wlock while setting branch in kwdemo
Augie Fackler - Nov. 27, 2013, 2:59 p.m.
On Wed, Nov 20, 2013 at 12:57:41PM +0000, Christian Ebert wrote:
> # HG changeset patch
> # User Christian Ebert <blacktrash@gmx.net>
> # Date 1384952108 0
> #      Wed Nov 20 12:55:08 2013 +0000
> # Node ID 45d15012f02b332cdc16f00a894b1ec29926633d
> # Parent  6d4fda48b4e3710cfc2161f676adb46c424079d3
> keyword: wlock while setting branch in kwdemo

queued, thanks

>
> diff --git a/hgext/keyword.py b/hgext/keyword.py
> --- a/hgext/keyword.py
> +++ b/hgext/keyword.py
> @@ -439,7 +439,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()
>      for name, cmd in ui.configitems('hooks'):
>          if name.split('.', 1)[0].find('commit') > -1:
>              repo.ui.setconfig('hooks', name, '')
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -439,7 +439,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()
     for name, cmd in ui.configitems('hooks'):
         if name.split('.', 1)[0].find('commit') > -1:
             repo.ui.setconfig('hooks', name, '')