Use length of file instead of length of change for the dirstate entry.
+ hg init+ hg add a+ hg commit -m first -d 0 0 a+ hg add sub/b+ hg commit -m second -d 0 0 sub/b321+ hg co 0cat: sub/b: No such file or directoryls: sub: No such file or directory