Revert almost all of
5be434785317; add a test
Because of file copies, we should update the manifest dict only after
committing all files.
Use nullrev+count instead of count-1 in a newly introduced expression.
Before that repo.changelog.tip() was used, but this yields a node.
Of course many more places should be changed like this, this was just done
as an example.