changeset 38999:19344143b3e1

absorb: following UI conventions https://www.mercurial-scm.org/wiki/UIGuideline#adding_new_options
author David Demelier <markand@malikania.fr>
date Thu, 09 Aug 2018 13:13:00 +0200
parents d99468d2b09a
children 70a19e804deb
files hgext/absorb.py tests/test-absorb.t
diffstat 2 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/absorb.py	Wed Aug 08 19:29:02 2018 +0530
+++ b/hgext/absorb.py	Thu Aug 09 13:13:00 2018 +0200
@@ -14,11 +14,11 @@
 
     [absorb]
     # only check 50 recent non-public changesets at most
-    maxstacksize = 50
+    max-stack-size = 50
     # whether to add noise to new commits to avoid obsolescence cycle
-    addnoise = 1
+    add-noise = 1
     # make `amend --correlated` a shortcut to the main command
-    amendflag = correlated
+    amend-flag = correlated
 
     [color]
     absorb.node = blue bold
@@ -69,9 +69,9 @@
 configtable = {}
 configitem = registrar.configitem(configtable)
 
-configitem('absorb', 'addnoise', default=True)
-configitem('absorb', 'amendflag', default=None)
-configitem('absorb', 'maxstacksize', default=50)
+configitem('absorb', 'add-noise', default=True)
+configitem('absorb', 'amend-flag', default=None)
+configitem('absorb', 'max-stack-size', default=50)
 
 colortable = {
     'absorb.node': 'blue bold',
@@ -826,7 +826,7 @@
         """
         parents = p1 and (p1, node.nullid)
         extra = ctx.extra()
-        if self._useobsolete and self.ui.configbool('absorb', 'addnoise'):
+        if self._useobsolete and self.ui.configbool('absorb', 'add-noise'):
             extra['absorb_source'] = ctx.hex()
         mctx = overlaycontext(memworkingcopy, ctx, parents, extra=extra)
         # preserve phase
@@ -910,7 +910,7 @@
     return fixupstate.
     """
     if stack is None:
-        limit = ui.configint('absorb', 'maxstacksize')
+        limit = ui.configint('absorb', 'max-stack-size')
         stack = getdraftstack(repo['.'], limit)
         if limit and len(stack) >= limit:
             ui.warn(_('absorb: only the recent %d changesets will '
--- a/tests/test-absorb.t	Wed Aug 08 19:29:02 2018 +0530
+++ b/tests/test-absorb.t	Thu Aug 09 13:13:00 2018 +0200
@@ -268,7 +268,7 @@
   b Line 1
   b Line 2
 
-Test config option absorb.maxstacksize:
+Test config option absorb.max-stack-size:
 
   $ sedi 's/Line/line/' a b
   $ hg log -T '{rev}:{node} {desc}\n'
@@ -276,7 +276,7 @@
   2:74cfa6294160149d60adbf7582b99ce37a4597ec commit b 1
   1:28f10dcf96158f84985358a2e5d5b3505ca69c22 commit a 2
   0:f9a81da8dc53380ed91902e5b82c1b36255a4bd0 commit a 1
-  $ hg --config absorb.maxstacksize=1 absorb -pn
+  $ hg --config absorb.max-stack-size=1 absorb -pn
   absorb: only the recent 1 changesets will be analysed
   showing changes for a
           @@ -0,2 +0,2 @@
@@ -297,10 +297,10 @@
   > [experimental]
   > evolution=createmarkers
   > [absorb]
-  > addnoise=1
+  > add-noise=1
   > EOF
 
-  $ hg --config absorb.maxstacksize=3 absorb
+  $ hg --config absorb.max-stack-size=3 absorb
   absorb: only the recent 3 changesets will be analysed
   2 of 2 chunk(s) applied
   $ hg log -T '{rev}:{node|short} {desc} {get(extras, "absorb_source")}\n'