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

Matt Mackall mpm at selenic.com
Tue Jun 14 18:33:51 CDT 2011


On Tue, 2011-06-14 at 15:56 +0200, Martin Geisler wrote:
> Peter Arrenbrecht <peter.arrenbrecht at gmail.com> writes:
> 
> > On Tue, Jun 14, 2011 at 2:46 PM, Martin Geisler <mg at aragost.com> wrote:
> >> Peter Arrenbrecht <peter.arrenbrecht at gmail.com> writes:
> >>
> >>> # HG changeset patch
> >>> # User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
> >>> # Date 1307550273 -7200
> >>> hg: add opts argument to clone for internal remoteui
> >>>
> >>> diff --git a/mercurial/hg.py b/mercurial/hg.py
> >>> --- a/mercurial/hg.py
> >>> +++ b/mercurial/hg.py
> >>> @@ -169,7 +169,7 @@
> >>>                  continue
> >>>          _update(r, uprev)
> >>>
> >>> -def clone(ui, source, dest=None, pull=False, rev=None, update=True,
> >>> +def clone(ui, opts, source, dest=None, pull=False, rev=None, update=True,
> >>>            stream=False, branch=None):
> >>
> >> 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. 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.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list