[PATCH 1 of 3 V3] hg: make repository take filtername argument to avoid useless filtering

Augie Fackler durin42 at gmail.com
Thu Jan 7 09:38:04 UTC 2016


On Jan 6, 2016 20:10, "FUJIWARA Katsunori" <foozy at lares.dti.ne.jp> wrote:
>
> At Wed, 6 Jan 2016 00:57:02 +0900,
> Yuya Nishihara wrote:
> >
> > On Sun, 03 Jan 2016 20:03:45 +0900, FUJIWARA Katsunori wrote:
> > > # HG changeset patch
> > > # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> > > # Date 1451818994 -32400
> > > #      Sun Jan 03 20:03:14 2016 +0900
> > > # Node ID 85def1110482e9f731e56da12d0c6b624f4d8a45
> > > # Parent  b8405d739149cdd6d8d9bd5e3dd2ad8487b1f09a
> > > hg: make repository take filtername argument to avoid useless
filtering
> > >
> > > If user of 'repository()' wants non-"visible" view (or unfiltered
> > > repository), filtering for "visible" view itself is meaningless.
> > >
> > > diff --git a/mercurial/hg.py b/mercurial/hg.py
> > > --- a/mercurial/hg.py
> > > +++ b/mercurial/hg.py
> > > @@ -155,14 +155,16 @@ def _peerorrepo(ui, path, create=False):
> > >              f(ui, obj)
> > >      return obj
> > >
> > > -def repository(ui, path='', create=False):
> > > +def repository(ui, path='', create=False, filtername='visible'):
> > >      """return a repository object for the specified path"""
> > >      peer = _peerorrepo(ui, path, create)
> > >      repo = peer.local()
> > >      if not repo:
> > >          raise error.Abort(_("repository '%s' is not local") %
> > >                           (path or peer.url()))
> > > -    return repo.filtered('visible')
> > > +    if not filtername:
> > > +        return repo.unfiltered()
> > > +    return repo.filtered(filtername)
> >
> > The first two look good to me, but I hesitated to push them because
> > hg.repository() is very basic interface and I'm not sure if we want the
> > filtername argument there.
>
> From the point of view of resource efficiency, meaningless filtering
> in hg.repository() should be avoided, IMHO.
>
> But on the other hand, it is also reasonable that you hesitate
> changing very basic interface hg.repository().
>
> Should I resend the revised series without changing hg.repository() ?

I think I'd prefer that. I had the same unease with it as Yuya.

>
> > (I haven't read the patch 3 yet.)
> >
>
> ----------------------------------------------------------------------
> [FUJIWARA Katsunori]                             foozy at lares.dti.ne.jp
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160107/55e802c6/attachment-0002.html>


More information about the Mercurial-devel mailing list