See http://mercurial.selenic.com/bts/issue1986 for the original bug entry. Benoit and I talked about this on IRC and he figured out and fixed the problem. I've added a test case to check it.