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.
marked working directory as branch a
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
marked working directory as branch b
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
marked working directory as branch c
c 5:5ca481e59b8c
a 1:dd6b440dd85a
b 4:22df7444f7c1 (inactive)
default 0:19709c5a4e75 (inactive)
-------
c 5:5ca481e59b8c
a 1:dd6b440dd85a