patch: support diff data loss detection and upgrade
In worst case, generating diff in upgrade mode can be two times more expensive
than generating it in git mode directly: we may have to regenerate the whole
diff again whenever a git feature is detected. Also, the first diff attempt is
completely buffered instead of being streamed. That said, even without having
profiled it yet, I am convinced we can fast-path the upgrade mode if necessary
were it to be used in regular diff commands, and not only in mq where avoiding
data loss is worth the price.
% initialize darcs repo
Finished recording patch 'p0'
% branch and update
Finished recording patch 'p1.1'
% update source
Finished recording patch 'p1.2'
% merge branch
Backing up ./a(-darcs-backup0)
We have conflicts in the following files:
./a
Finished pulling and applying.
Finished recording patch 'p2'
% test file and directory move
Finished recording patch 'p3'
initializing destination darcs-repo-hg repository
scanning source...
sorting...
converting...
4 p0
3 p1.2
2 p1.1
1 p2
0 p3
o 4 "p3" files: dir/d dir/d2 dir2/d f ff
|
o 3 "p2" files: a dir/d dir/d2 f
|
o 2 "p1.1" files:
|
o 1 "p1.2" files: a b
|
o 0 "p0" files: a
7225b30cdf38257d5cc7780772c051b6f33e6d6b 644 a
1e88685f5ddec574a34c70af492f95b6debc8741 644 b
d278f41640da5fc303a4cf9894af31c2983fc11d 644 dir2/d
ef5c76581d78340f568d5f48d679bf307452cbc9 644 ff