Patchwork [2,of,2,V2] wlock: reword the devel warning

login
register
mail settings
Submitter Pierre-Yves David
Date April 13, 2015, 6:18 p.m.
Message ID <9e53250e945e3e6f1f70.1428949122@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/8640/
State Accepted
Headers show

Comments

Pierre-Yves David - April 13, 2015, 6:18 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1428859715 14400
#      Sun Apr 12 13:28:35 2015 -0400
# Node ID 9e53250e945e3e6f1f7068c912b1e3305abe8890
# Parent  6a40db689612929075d307e9fa4ccd5702ef5922
wlock: reword the devel warning

We change the wording of the developer warning:

  -  "lock" taken before "wlock"
  +  "wlock" acquired after "lock"

The goals here are to:

- Put the "subject" as the first word,
- use "acquired" instead of "taken" since it seems more accurate.
Ryan McElroy - April 14, 2015, 3:46 a.m.
On 4/13/2015 11:18 AM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1428859715 14400
> #      Sun Apr 12 13:28:35 2015 -0400
> # Node ID 9e53250e945e3e6f1f7068c912b1e3305abe8890
> # Parent  6a40db689612929075d307e9fa4ccd5702ef5922
> wlock: reword the devel warning
>
> We change the wording of the developer warning:
>
>    -  "lock" taken before "wlock"
>    +  "wlock" acquired after "lock"
>
> The goals here are to:
>
> - Put the "subject" as the first word,
> - use "acquired" instead of "taken" since it seems more accurate.
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1208,11 +1208,11 @@ class localrepository(object):
>   
>           if (self.ui.configbool('devel', 'all')
>                   or self.ui.configbool('devel', 'check-locks')):
>               l = self._lockref and self._lockref()
>               if l is not None and l.held:
> -                msg = '"lock" taken before "wlock"\n'
> +                msg = '"wlock" acquired after "lock"\n'
>                   if self.ui.tracebackflag:
>                       util.debugstacktrace(msg, 1)
>                   else:
>                       self.ui.write_err(msg)
>   
> diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t
> --- a/tests/test-devel-warnings.t
> +++ b/tests/test-devel-warnings.t
> @@ -42,19 +42,19 @@
>   
>     $ hg init lock-checker
>     $ cd lock-checker
>     $ hg buggylocking
>     transaction with no lock
> -  "lock" taken before "wlock"
> +  "wlock" acquired after "lock"
>     $ cat << EOF >> $HGRCPATH
>     > [devel]
>     > all=0
>     > check-locks=1
>     > EOF
>     $ hg buggylocking
>     transaction with no lock
> -  "lock" taken before "wlock"
> +  "wlock" acquired after "lock"
>     $ hg buggylocking --traceback
>     transaction with no lock
>      at:
>      */hg:* in * (glob)
>      */mercurial/dispatch.py:* in run (glob)
> @@ -65,11 +65,11 @@
>      */mercurial/dispatch.py:* in _runcommand (glob)
>      */mercurial/dispatch.py:* in checkargs (glob)
>      */mercurial/dispatch.py:* in <lambda> (glob)
>      */mercurial/util.py:* in check (glob)
>      $TESTTMP/buggylocking.py:* in buggylocking (glob)
> -  "lock" taken before "wlock"
> +  "wlock" acquired after "lock"
>      at:
>      */hg:* in * (glob)
>      */mercurial/dispatch.py:* in run (glob)
>      */mercurial/dispatch.py:* in dispatch (glob)
>      */mercurial/dispatch.py:* in _runcatch (glob)
>
I think this order is better.
Pierre-Yves David - April 16, 2015, 6:58 a.m.
On 04/13/2015 11:46 PM, Ryan McElroy wrote:
> On 4/13/2015 11:18 AM, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>> # Date 1428859715 14400
>> #      Sun Apr 12 13:28:35 2015 -0400
>> # Node ID 9e53250e945e3e6f1f7068c912b1e3305abe8890
>> # Parent  6a40db689612929075d307e9fa4ccd5702ef5922
>> wlock: reword the devel warning

These two are pushed to the clowncopter (along others) after Matt's 
review IRL.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1208,11 +1208,11 @@  class localrepository(object):
 
         if (self.ui.configbool('devel', 'all')
                 or self.ui.configbool('devel', 'check-locks')):
             l = self._lockref and self._lockref()
             if l is not None and l.held:
-                msg = '"lock" taken before "wlock"\n'
+                msg = '"wlock" acquired after "lock"\n'
                 if self.ui.tracebackflag:
                     util.debugstacktrace(msg, 1)
                 else:
                     self.ui.write_err(msg)
 
diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t
--- a/tests/test-devel-warnings.t
+++ b/tests/test-devel-warnings.t
@@ -42,19 +42,19 @@ 
 
   $ hg init lock-checker
   $ cd lock-checker
   $ hg buggylocking
   transaction with no lock
-  "lock" taken before "wlock"
+  "wlock" acquired after "lock"
   $ cat << EOF >> $HGRCPATH
   > [devel]
   > all=0
   > check-locks=1
   > EOF
   $ hg buggylocking
   transaction with no lock
-  "lock" taken before "wlock"
+  "wlock" acquired after "lock"
   $ hg buggylocking --traceback
   transaction with no lock
    at:
    */hg:* in * (glob)
    */mercurial/dispatch.py:* in run (glob)
@@ -65,11 +65,11 @@ 
    */mercurial/dispatch.py:* in _runcommand (glob)
    */mercurial/dispatch.py:* in checkargs (glob)
    */mercurial/dispatch.py:* in <lambda> (glob)
    */mercurial/util.py:* in check (glob)
    $TESTTMP/buggylocking.py:* in buggylocking (glob)
-  "lock" taken before "wlock"
+  "wlock" acquired after "lock"
    at:
    */hg:* in * (glob)
    */mercurial/dispatch.py:* in run (glob)
    */mercurial/dispatch.py:* in dispatch (glob)
    */mercurial/dispatch.py:* in _runcatch (glob)