Patchwork D9690: debuglock: rename flag names to better clarity

login
register
mail settings
Submitter phabricator
Date Jan. 8, 2021, 1:50 p.m.
Message ID <differential-rev-PHID-DREV-n6usmffos2admpxqw36x-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48001/
State Superseded
Headers show

Comments

phabricator - Jan. 8, 2021, 1:50 p.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `--force-lock` sounds as if we are taking the lock however in reality it's the
  opposite.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9690

AFFECTED FILES
  mercurial/debugcommands.py
  relnotes/next
  tests/test-completion.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -295,7 +295,7 @@ 
   debuginstall: template
   debugknown: 
   debuglabelcomplete: 
-  debuglocks: force-lock, force-wlock, set-lock, set-wlock
+  debuglocks: force-free-lock, force-free-wlock, set-lock, set-wlock
   debugmanifestfulltextcache: clear, add
   debugmergestate: style, template
   debugnamecomplete: 
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -53,6 +53,8 @@ 
 
 == Backwards Compatibility Changes ==
 
+ * `--force-lock` and `--force-wlock` options on `hg debuglock` command are
+   renamed to `--force-free-lock` and `--force-free-wlock` respectively.
 
 
 == Internal API Changes ==
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1889,10 +1889,10 @@ 
 @command(
     b'debuglocks',
     [
-        (b'L', b'force-lock', None, _(b'free the store lock (DANGEROUS)')),
+        (b'L', b'force-free-lock', None, _(b'free the store lock (DANGEROUS)')),
         (
             b'W',
-            b'force-wlock',
+            b'force-free-wlock',
             None,
             _(b'free the working state lock (DANGEROUS)'),
         ),
@@ -1931,11 +1931,11 @@ 
 
     """
 
-    if opts.get('force_lock'):
+    if opts.get('force_free_lock'):
         repo.svfs.unlink(b'lock')
-    if opts.get('force_wlock'):
+    if opts.get('force_free_wlock'):
         repo.vfs.unlink(b'wlock')
-    if opts.get('force_lock') or opts.get('force_wlock'):
+    if opts.get('force_free_lock') or opts.get('force_free_wlock'):
         return 0
 
     locks = []