dirstate: fix rebuild; add a test
If rebuild calls invalidate, it will just queue a (re)read of the dirstate
file, while what we really want is to empty the current state.
<table class="slogEntry parity#parity#">
<tr>
<td class="age">#date|age#</td>
<td class="author">#author|person#</td>
<td class="node"><a href="#url#rev/#node|short#{sessionvars%urlparameter}">#desc|strip|firstline|escape#</a></td>
</tr>
</table>