mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
d6ce43b965
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.
64 lines
1.5 KiB
Bash
Executable File
64 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
echo "[extensions]" >> $HGRCPATH
|
|
echo "autodiff=$TESTDIR/autodiff.py" >> $HGRCPATH
|
|
echo "[diff]" >> $HGRCPATH
|
|
echo "nodates=1" >> $HGRCPATH
|
|
|
|
hg init repo
|
|
cd repo
|
|
echo '% make a combination of new, changed and deleted file'
|
|
echo regular > regular
|
|
echo rmregular > rmregular
|
|
touch rmempty
|
|
echo exec > exec
|
|
chmod +x exec
|
|
echo rmexec > rmexec
|
|
chmod +x rmexec
|
|
echo setexec > setexec
|
|
echo unsetexec > unsetexec
|
|
chmod +x unsetexec
|
|
echo binary > binary
|
|
python -c "file('rmbinary', 'wb').write('\0')"
|
|
hg ci -Am addfiles
|
|
echo regular >> regular
|
|
echo newregular >> newregular
|
|
rm rmempty
|
|
touch newempty
|
|
rm rmregular
|
|
echo exec >> exec
|
|
echo newexec > newexec
|
|
chmod +x newexec
|
|
rm rmexec
|
|
chmod +x setexec
|
|
chmod -x unsetexec
|
|
python -c "file('binary', 'wb').write('\0\0')"
|
|
python -c "file('newbinary', 'wb').write('\0')"
|
|
rm rmbinary
|
|
hg addremove
|
|
|
|
echo '% git=no: regular diff for all files'
|
|
hg autodiff --git=no
|
|
|
|
echo '% git=no: git diff for single regular file'
|
|
hg autodiff --git=yes regular
|
|
|
|
echo '% git=auto: regular diff for regular files and removals'
|
|
hg autodiff --git=auto regular newregular rmregular rmbinary rmexec
|
|
|
|
for f in exec newexec setexec unsetexec binary newbinary newempty rmempty; do
|
|
echo '% git=auto: git diff for' $f
|
|
hg autodiff --git=auto $f
|
|
done
|
|
|
|
echo '% git=warn: regular diff with data loss warnings'
|
|
hg autodiff --git=warn
|
|
|
|
echo '% git=abort: fail on execute bit change'
|
|
hg autodiff --git=abort regular setexec
|
|
|
|
echo '% git=abort: succeed on regular file'
|
|
hg autodiff --git=abort regular
|
|
|
|
cd ..
|