Patchwork [1,of,5,V2] debugdirstate: convert keyword parameters to **opts

login
register
mail settings
Submitter Christian Delahousse
Date Nov. 17, 2015, 10:54 p.m.
Message ID <6d207a588cef3e66d71d.1447800856@dev4253.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11440/
State Accepted
Headers show

Comments

Christian Delahousse - Nov. 17, 2015, 10:54 p.m.
# HG changeset patch
# User Christian Delahousse <cdelahousse@fb.com>
# Date 1447277280 28800
#      Wed Nov 11 13:28:00 2015 -0800
# Node ID 6d207a588cef3e66d71dce337b0d2b14d921c600
# Parent  2da6a2dbfc42bdec4bcaf47da947c64ff959a59c
debugdirstate: convert keyword parameters to **opts

Removes the named arguments and replaces them by accessing opts. This will be
used in the next patch in the series because we'll be adding more flags to
debugdirstate
Pierre-Yves David - Nov. 18, 2015, 10:44 a.m.
On 11/17/2015 02:54 PM, cdelahousse@fb.com wrote:
> # HG changeset patch
> # User Christian Delahousse <cdelahousse@fb.com>
> # Date 1447277280 28800
> #      Wed Nov 11 13:28:00 2015 -0800
> # Node ID 6d207a588cef3e66d71dce337b0d2b14d921c600
> # Parent  2da6a2dbfc42bdec4bcaf47da947c64ff959a59c
> debugdirstate: convert keyword parameters to **opts
>
> Removes the named arguments and replaces them by accessing opts. This will be
> used in the next patch in the series because we'll be adding more flags to
> debugdirstate

The first one is pushed, let's talk about the second one tomorrow.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3162,8 +3162,12 @@ 
     [('', 'nodates', None, _('do not display the saved mtime')),
     ('', 'datesort', None, _('sort by saved mtime'))],
     _('[OPTION]...'))
-def debugstate(ui, repo, nodates=None, datesort=None):
+def debugstate(ui, repo, **opts):
     """show the contents of the current dirstate"""
+
+    nodates = opts.get('nodates')
+    datesort = opts.get('datesort')
+
     timestr = ""
     if datesort:
         keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename