# HG changeset patch # User Matt Harbison # Date 1435588496 14400 # Node ID 1cce8112147298dd164612546267d4450e451f9d # Parent 24cda1dd45ff35af8acbe96fb5559d01cd333181 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 -r 24cda1dd45ff -r 1cce81121472 mercurial/revset.py --- a/mercurial/revset.py Sun Jun 28 13:38:03 2015 -0400 +++ b/mercurial/revset.py Mon Jun 29 10:34:56 2015 -0400 @@ -1468,7 +1468,10 @@ ps = set() cl = repo.changelog for r in getset(repo, fullreposet(repo), x): - ps.update(cl.parentrevs(r)) + if r is None: + ps.update(p.rev() for p in repo[r].parents()) + else: + ps.update(cl.parentrevs(r)) ps -= set([node.nullrev]) return subset & ps diff -r 24cda1dd45ff -r 1cce81121472 tests/test-add.t --- a/tests/test-add.t Sun Jun 28 13:38:03 2015 -0400 +++ b/tests/test-add.t Mon Jun 29 10:34:56 2015 -0400 @@ -75,6 +75,13 @@ $ hg ci -m 0 --traceback + $ hg log -r "heads(. or wdir() & file('**'))" + changeset: 0:* (glob) + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: 0 + should fail $ hg add a @@ -99,6 +106,15 @@ M a ? a.orig +wdir doesn't cause a crash, and can be dynamically selected if dirty + + $ hg log -r "heads(. or wdir() & file('**'))" + changeset: 2:*+ (glob) + parent: 2:* (glob) + parent: 1:* (glob) + user: test + date: * (glob) + should fail $ hg add a