Patchwork [1,of,1] cmdutil: make options argument optional

mail settings
Submitter Pierre-Yves David
Date Jan. 4, 2013, 7:22 p.m.
Message ID <11a3423dd8baebc31f91.1357327336@yamac.lan>
Download mbox | patch
Permalink /patch/398/
State Accepted
Commit 9807e7d596c393afa140ef7801034a8a36a142b6
Headers show


Pierre-Yves David - Jan. 4, 2013, 7:22 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at>
# Date 1357303687 -3600
# Node ID 11a3423dd8baebc31f912d69d160394f15140dc9
# Parent  b178bb7e2c7541416e23e37164a26f710019aa4f
cmdutil: make options argument optional

There is not reason to force passing of an empty options list.
Bryan O'Sullivan - Jan. 7, 2013, 7:27 p.m.
On Fri, Jan 04, 2013 at 08:22:16PM +0100, Pierre-Yves David wrote:
> cmdutil: make options argument optional

Pushed to crew, thanks.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -1997,15 +1997,15 @@  def revert(ui, repo, ctx, parents, *pats
 def command(table):
     '''returns a function object bound to table which can be used as
     a decorator for populating table as a command table'''
-    def cmd(name, options, synopsis=None):
+    def cmd(name, options=(), synopsis=None):
         def decorator(func):
             if synopsis:
-                table[name] = func, options[:], synopsis
+                table[name] = func, list(options), synopsis
-                table[name] = func, options[:]
+                table[name] = func, list(options)
             return func
         return decorator
     return cmd