Mercurial > hg-stable
annotate tests/test-diff-upgrade @ 10189:e451e599fbcf
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.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 01 Jan 2010 20:54:05 +0100 |
parents | |
children | 4484a7b661f2 9b3913baba0c |
rev | line source |
---|---|
10189
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 echo "[extensions]" >> $HGRCPATH |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 echo "autodiff=$TESTDIR/autodiff.py" >> $HGRCPATH |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 echo "[diff]" >> $HGRCPATH |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 echo "nodates=1" >> $HGRCPATH |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
8 hg init repo |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 cd repo |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 echo '% make a combination of new, changed and deleted file' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 echo regular > regular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 echo rmregular > rmregular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 touch rmempty |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 echo exec > exec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 chmod +x exec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 echo rmexec > rmexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 chmod +x rmexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 echo setexec > setexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 echo unsetexec > unsetexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
20 chmod +x unsetexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
21 echo binary > binary |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
22 python -c "file('rmbinary', 'wb').write('\0')" |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
23 hg ci -Am addfiles |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
24 echo regular >> regular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
25 echo newregular >> newregular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
26 rm rmempty |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
27 touch newempty |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
28 rm rmregular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
29 echo exec >> exec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
30 echo newexec > newexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
31 chmod +x newexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
32 rm rmexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
33 chmod +x setexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
34 chmod -x unsetexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
35 python -c "file('binary', 'wb').write('\0\0')" |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
36 python -c "file('newbinary', 'wb').write('\0')" |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
37 rm rmbinary |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 hg addremove |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
40 echo '% git=no: regular diff for all files' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 hg autodiff --git=no |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
42 |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 echo '% git=no: git diff for single regular file' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
44 hg autodiff --git=yes regular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
45 |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
46 echo '% git=auto: regular diff for regular files and removals' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
47 hg autodiff --git=auto regular newregular rmregular rmbinary rmexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
48 |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 for f in exec newexec setexec unsetexec binary newbinary newempty rmempty; do |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
50 echo '% git=auto: git diff for' $f |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 hg autodiff --git=auto $f |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 done |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 echo '% git=warn: regular diff with data loss warnings' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 hg autodiff --git=warn |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
56 |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
57 echo '% git=abort: fail on execute bit change' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
58 hg autodiff --git=abort regular setexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
59 |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
60 echo '% git=abort: succeed on regular file' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
61 hg autodiff --git=abort regular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
62 |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
63 cd .. |