[PATCH 2 of 2] copy shared command options to prevent duplicates (issue2772)

Matt Mackall mpm at selenic.com
Thu May 26 16:44:08 CDT 2011


On Thu, 2011-05-26 at 19:57 +0300, Idan Kamara wrote:
> # HG changeset patch
> # User Idan Kamara <idankk86 at gmail.com>
> # Date 1306428989 -10800
> # Node ID c0b716bb34d346c3c76589e3537430934898d0bd
> # Parent  838230858bfba5abfa76e9ed3b57ef0681cba1a2
> copy shared command options to prevent duplicates (issue2772)

Doesn't this do this much more simply, now that we've got the decorator?

diff -r 63c3c8783e54 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Thu May 26 19:00:47 2011 +0300
+++ b/mercurial/cmdutil.py	Thu May 26 16:43:21 2011 -0500
@@ -1215,9 +1215,9 @@
     def cmd(name, options, synopsis=None):
         def decorator(func):
             if synopsis:
-                table[name] = func, options, synopsis
+                table[name] = func, options[:], synopsis
             else:
-                table[name] = func, options
+                table[name] = func, options[:]
             return func
         return decorator
 

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list