The previous patch added the dirstate-tree feature gate to enable the two
dirstate implementations to co-habit while the tree-based one gets better.
This patch copies over the code that differs, be it because the algorithm
changed or because the borrowing rules are different.
Indeed, DirstateTree is not observationally equivalent to the std HashMap in
the APIs we use: it does not have the Entry API (yet?) and its iterator
returns owned values instead of references. This last point is because the
implementation needs to be changed to a more clever and efficient solution.
I think I asked you a long time ago if we still need this ugly argument. Do you know if we do? I.e, I was hoping we could remove it from the Python and C code as well by filtering those entries out before we call this.