Patchwork absorb: following UI conventions

login
register
mail settings
Submitter David Demelier
Date Aug. 9, 2018, 1:57 p.m.
Message ID <c459c70a255122725d1a.1533823033@x1>
Download mbox | patch
Permalink /patch/33449/
State Accepted
Headers show

Comments

David Demelier - Aug. 9, 2018, 1:57 p.m.
# HG changeset patch
# User David Demelier <markand@malikania.fr>
# Date 1533813180 -7200
#      Thu Aug 09 13:13:00 2018 +0200
# Node ID c459c70a255122725d1aeb3902154d4d5aa2d6a9
# Parent  382b055cc35811e601bcd9113392cc45a0464886
absorb: following UI conventions

https://www.mercurial-scm.org/wiki/UIGuideline#adding_new_options
Augie Fackler - Aug. 9, 2018, 2:02 p.m.
> On Aug 9, 2018, at 09:57, David Demelier <markand@malikania.fr> wrote:
> 
> # HG changeset patch
> # User David Demelier <markand@malikania.fr>
> # Date 1533813180 -7200
> #      Thu Aug 09 13:13:00 2018 +0200
> # Node ID c459c70a255122725d1aeb3902154d4d5aa2d6a9
> # Parent  382b055cc35811e601bcd9113392cc45a0464886
> absorb: following UI conventions


Queued, many thanks.

Patch

diff -r 382b055cc358 -r c459c70a2551 hgext/absorb.py
--- a/hgext/absorb.py	Sun Feb 25 21:04:33 2018 +0900
+++ 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 '
diff -r 382b055cc358 -r c459c70a2551 tests/test-absorb.t
--- a/tests/test-absorb.t	Sun Feb 25 21:04:33 2018 +0900
+++ 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 sf
+  $ hg --config absorb.max-stack-size=3 sf
   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'