Refactor iterators and diff

This is an effort to refactor the iterator and diff code to make certain things more consistent and to fix certain corner cases that came up during the implementation of checkout. There are a number of things going on here...

- [x] Make all iterators support both auto-expansion of directories and explicit expansion
- [x] Make iterators support including tree entries during iteration
- [ ] Rewrite diff typechange handling using iterators that include tree entries
- [ ] Separate workdir diffs which require special ignore/untracked handling and prefer non auto-expanding iterators from other diffs which can use much simpler code and all auto-expanding iterators.
- [ ] Make any final public diff API cleanups (binary flags, non-mutating transforms)

Once this is done, it should be possible to fix checkout one more time to simplify the code there and repair the few remaining corner cases where the old iterators made it very hard to do the right thing.