[PATCH 1 of 3] Prevent command options from aliasing each other

Matt Mackall mpm at selenic.com
Wed Jul 8 12:45:02 CDT 2009


On Mon, 2009-07-06 at 23:12 +0200, Dan Villiom Podlaski Christiansen
wrote:
> On 6 Jul 2009, at 22:37, Matt Mackall wrote:
> 
> > On Mon, 2009-07-06 at 13:22 +0000, Dan Villiom Podlaski Christiansen
> > wrote:
> >> # HG changeset patch
> >> # User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
> >> # Date 1246878985 -7200
> >> # Node ID 96e8bf2fe345a6caa2f4627615b5f1fb3afd61bd
> >> # Parent  95046688f80fbe481241ed3affeed205ce378b7e
> >> Prevent command options from aliasing each other.
> >>
> >> This may lead to changes to options for one command inadvertently
> >> affecting other commands.
> >
> > Confusing description. Might be better to just say: modifying an  
> > option list without copying it first makes a mess.
> 
> Good point :)
> 
> > But that still leaves me puzzled. You've fixed the issue in  
> > wrapcommand, so why do we need [] + foo in the various command table  
> > entries? The right way to copy a list is list(foo).
> 
> I just followed the style of the existing code. (Another ‘[] +  
> whatever’ was added in b9a8b616521d.[1])
> 
> The main reason for adding those was that I changed them before coming  
> up with the fix for wrapcommand(). However, I still consider the  
> changes useful; without them, explicitly modifying the cmdtable entry  
> of one command could make a mess too…

Seems like we'd end up with a lot of these. If we need to do this a lot,
we should instead add a helper function.

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial-devel mailing list