[PATCH] revset: fix a crash in parents() when 'wdir()' is in the set

Yuya Nishihara yuya at tcha.org
Tue Jun 30 07:36:00 CDT 2015


On Mon, 29 Jun 2015 13:15:08 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1435588496 14400
> #      Mon Jun 29 10:34:56 2015 -0400
> # Node ID 6fb8a76fa2afa847734c15ef7b2e22a94505c591
> # Parent  ff5172c830022b64cc5bd1bae36b2276e9dc6e5d
> revset: fix a crash in parents() when 'wdir()' is in the set
> 
> The crash was "TypeError: expected string or Unicode object, NoneType found"
> down in revlog.parentrevs().  This fixes heads() too (which is where I found
> it.)
> 
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -1468,7 +1468,10 @@ def parents(repo, subset, x):
>          ps = set()
>          cl = repo.changelog
>          for r in getset(repo, fullreposet(repo), x):
> -            ps.update(cl.parentrevs(r))
> +            if r is None:
> +                ps.update([repo['.'].rev()])

It should be (p.rev() for p in repo[r].parents()).


More information about the Mercurial-devel mailing list