[PATCH] revset: use "repo.changelog" instead of "list(repo)" for resource efficiency

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed Feb 20 07:02:40 CST 2013


At Tue, 19 Feb 2013 13:31:54 -0600,
Kevin Bullock wrote:
> 
> On Feb 19, 2013, at 1:08 PM, Dirkjan Ochtman wrote:
> 
> > On Sun, Feb 17, 2013 at 5:08 PM, FUJIWARA Katsunori
> > <foozy at lares.dti.ne.jp> wrote:
> >> # HG changeset patch
> >> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> >> # Date 1361115858 -32400
> >> # Node ID 06fb2582618f43400b38ac4c791410d2fc748d2c
> >> # Parent  f12804d3ff801b989cb2aab1aad93047a8db46f1
> >> revset: use "repo.changelog" instead of "list(repo)" for resource efficiency
> > 
> > Doesn't that kill the filtering? IIRC Pierre-Yves was moving in the
> > other direction on these kinds of things.
> 
> Nope, repo.changelog is filtered on a filtered repo object.

Yes, repo.changelog is filtered.

But I found my own mistake around hidden revisions.

"list(repo)" uses "changelog.__iter__()" to create list object as
subset.

So, "len(subset) == len(repo)" is not True, when there are some hidden
revisions. This causes "x in subset" check in "stringset()" below:

    def stringset(repo, subset, x):
        x = repo[x].rev()
        if x == -1 and len(subset) == len(repo):
            return [-1]
        if len(subset) == len(repo) or x in subset:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            return [x]
        return []

But "repo.changelog" as subset causes "len(subset) == len(repo)"
always, so ID of hidden revision specified directly in revset
expression is treated as valid one, even if --hidden is not specified
in command line.

So, this patch should also add "repo.filteredrevs" check into above
code.

I'll try to resend refined one.

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy at lares.dti.ne.jp


More information about the Mercurial-devel mailing list