[PATCH 2 of 6] hg: add opts argument to clone for internal remoteui

Martin Geisler mg at aragost.com
Wed Jun 15 02:32:04 CDT 2011


Matt Mackall <mpm at selenic.com> writes:

> On Tue, 2011-06-14 at 15:56 +0200, Martin Geisler wrote:
>> Peter Arrenbrecht <peter.arrenbrecht at gmail.com> writes:
>> 
>> >> Should the opts dict not replace the existing keyword arguments?
>> >>
>> >> From reading the patch, it seems that there is now an implicit
>> >> coupling between pull/opts['pull'] and update/opts['noupdate'].
>> >
>> > Where would this be? Seems to me that passing opts['pull'] or
>> > opts['noupdate'] to hg.clone has no effect.
>> 
>> Ehm, hg.clone takes a 'pull' and an 'update' argument and I suggest
>> it should take them from an opts dict. Like
>> 
>>   def clone(ui, source, ..., **opts):
>>       # extract old function arguments
>>       update = not opts.get('noupdate')
>>       pull = opts.get('pull')
>>       ...
>> 
>> Right now, the caller will specify both pull and have opts['pull']
>> set to the same value (hopefully).
>
> No thanks.
>
> Much like functions that diff opts, only options related to
> configuring ssh/http/etc connection details are interesting here.
> Everything else is ignored.

What started me was the implicit ignoring: some options are passed on to
remoteui, some options are ignored in clone (but the caller most likely
extracted them and passed them as explicit arguments).

> This pattern avoids tediously unpacking the generic connection options
> list simply to pass them through to another function.
>
> We can name this parameter connectionopts if you want.

Peter and I discussed this on IRC and came up with peeropts.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/


More information about the Mercurial-devel mailing list