[PATCH 1 of 3 V3] hg: make repository take filtername argument to avoid useless filtering
Yuya Nishihara
yuya at tcha.org
Tue Jan 5 09:57:02 CST 2016
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.
(I haven't read the patch 3 yet.)
More information about the Mercurial-devel
mailing list