tests/test-git-export
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Mon, 20 Nov 2006 19:32:35 -0200
changeset 3693 454b3a8cdf28
parent 3368 751df21dad72
child 3694 c0b1a0c72c7d
permissions -rwxr-xr-x
diff: improve detection of renames when diffing across many revisions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2892
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     1
#!/bin/sh
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     2
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     3
hg init a
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     4
cd a
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     5
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     6
echo start > start
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     7
hg ci -Amstart -d '0 0'
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     8
echo new > new
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     9
hg ci -Amnew -d '0 0'
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    10
echo '% new file'
3192
096f1c73cdc3 Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents: 3063
diff changeset
    11
hg diff --git -r 0
2892
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    12
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    13
hg cp new copy
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    14
hg ci -mcopy -d '0 0'
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    15
echo '% copy'
3192
096f1c73cdc3 Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents: 3063
diff changeset
    16
hg diff --git -r 1:tip
2892
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    17
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    18
hg mv copy rename
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    19
hg ci -mrename -d '0 0'
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    20
echo '% rename'
3192
096f1c73cdc3 Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents: 3063
diff changeset
    21
hg diff --git -r 2:tip
2892
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    22
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    23
hg rm rename
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    24
hg ci -mdelete -d '0 0'
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    25
echo '% delete'
3192
096f1c73cdc3 Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents: 3063
diff changeset
    26
hg diff --git -r 3:tip
2892
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    27
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    28
cat > src <<EOF
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    29
1
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    30
2
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    31
3
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    32
4
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    33
5
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    34
EOF
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    35
hg ci -Amsrc -d '0 0'
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    36
chmod +x src
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    37
hg ci -munexec -d '0 0'
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    38
echo '% chmod 644'
3192
096f1c73cdc3 Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents: 3063
diff changeset
    39
hg diff --git -r 5:tip
2892
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    40
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    41
hg mv src dst
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    42
chmod -x dst
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    43
echo a >> dst
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    44
hg ci -mrenamemod -d '0 0'
8b02af865990 Add diff --git option
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    45
echo '% rename+mod+chmod'
3192
096f1c73cdc3 Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents: 3063
diff changeset
    46
hg diff --git -r 6:tip
3063
035fd2029575 git --diff: fix traceback when getting mode change
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2935
diff changeset
    47
035fd2029575 git --diff: fix traceback when getting mode change
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2935
diff changeset
    48
echo '% nonexistent in tip+chmod'
3192
096f1c73cdc3 Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents: 3063
diff changeset
    49
hg diff --git -r 5:6
3368
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    50
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    51
echo '% binary diff'
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    52
cp $TESTDIR/binfile.bin .
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    53
hg add binfile.bin
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    54
hg diff --git > b.diff
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    55
cat b.diff
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    56
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    57
echo '% import binary diff'
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    58
hg revert binfile.bin
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    59
rm binfile.bin
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    60
hg import -mfoo b.diff
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    61
cmp binfile.bin $TESTDIR/binfile.bin
751df21dad72 Add test for git binary diff support
Brendan Cully <brendan@kublai.com>
parents: 3192
diff changeset
    62
3693
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    63
echo
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    64
echo '% diff across many revisions'
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    65
hg mv dst dst2
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    66
hg ci -m 'mv dst dst2' -d '0 0'
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    67
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    68
echo >> start
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    69
hg ci -m 'change start' -d '0 0'
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    70
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    71
hg revert -r -2 start
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    72
hg mv dst2 dst3
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    73
hg ci -m 'mv dst2 dst3; revert start' -d '0 0'
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    74
454b3a8cdf28 diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3368
diff changeset
    75
hg diff --git -r 9:11