annotate tests/test-copy2 @ 4679:826659bd8053

git patches: correct handling of filenames with spaces Add a trailing TAB to the "--- filename" lines if there's a space in the file name. This allows patch(1) to work correctly. The same is done for diff --nodates. This was originally suggested by Andrei Vermel, but at the time I thought git was doing something different.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 22 Jun 2007 19:06:04 -0300
parents de8ec7e1753a
children 719c402258ee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
1 #!/bin/sh
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
2
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
3 hg init
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
4 echo foo > foo
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
5 hg add foo
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
6 hg commit -m1 -d"0 0"
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
7
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
8 echo "# should show copy"
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
9 hg copy foo bar
1168
235e0effa672 Fixed two tests to run with bourne shell.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1127
diff changeset
10 hg debugstate|grep '^copy'
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
11
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
12 echo "# shouldn't show copy"
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
13 hg commit -m2 -d"0 0"
1168
235e0effa672 Fixed two tests to run with bourne shell.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1127
diff changeset
14 hg debugstate|grep '^copy'
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
15
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
16 echo "# should match"
3853
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1252
diff changeset
17 hg debugindex .hg/store/data/foo.i
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
18 hg debugrename bar
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
19
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
20 echo bleah > foo
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
21 echo quux > bar
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
22 hg commit -m3 -d"0 0"
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
23
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
24 echo "# should not be renamed"
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
25 hg debugrename bar
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
26
1249
a5355fa5e33a Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents: 1168
diff changeset
27 hg copy -f foo bar
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
28 echo "# should show copy"
1168
235e0effa672 Fixed two tests to run with bourne shell.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1127
diff changeset
29 hg debugstate|grep '^copy'
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
30 hg commit -m3 -d"0 0"
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
31
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
32 echo "# should show no parents for tip"
3853
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1252
diff changeset
33 hg debugindex .hg/store/data/bar.i
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
34 echo "# should match"
3853
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1252
diff changeset
35 hg debugindex .hg/store/data/foo.i
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
36 hg debugrename bar
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
37
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
38 echo "# should show no copies"
1168
235e0effa672 Fixed two tests to run with bourne shell.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1127
diff changeset
39 hg debugstate|grep '^copy'
1127
19b048da4da9 Fixed test-copy2 with only looking at copied files.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1117
diff changeset
40
4374
de612b5f8d59 Make copy --after work for files that have been hg added.
Brendan Cully <brendan@kublai.com>
parents: 3853
diff changeset
41 echo "# copy --after on an added file"
de612b5f8d59 Make copy --after work for files that have been hg added.
Brendan Cully <brendan@kublai.com>
parents: 3853
diff changeset
42 cp bar baz
de612b5f8d59 Make copy --after work for files that have been hg added.
Brendan Cully <brendan@kublai.com>
parents: 3853
diff changeset
43 hg add baz
de612b5f8d59 Make copy --after work for files that have been hg added.
Brendan Cully <brendan@kublai.com>
parents: 3853
diff changeset
44 hg cp -A bar baz
de612b5f8d59 Make copy --after work for files that have been hg added.
Brendan Cully <brendan@kublai.com>
parents: 3853
diff changeset
45 hg st -C
de612b5f8d59 Make copy --after work for files that have been hg added.
Brendan Cully <brendan@kublai.com>
parents: 3853
diff changeset
46
4677
de8ec7e1753a dirstate.status: if a file is marked as copied, consider it modified
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4374
diff changeset
47 echo "# foo was clean:"
de8ec7e1753a dirstate.status: if a file is marked as copied, consider it modified
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4374
diff changeset
48 hg st -AC foo
de8ec7e1753a dirstate.status: if a file is marked as copied, consider it modified
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4374
diff changeset
49 echo "# but it's considered modified after a copy --after --force"
de8ec7e1753a dirstate.status: if a file is marked as copied, consider it modified
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4374
diff changeset
50 hg copy -Af bar foo
de8ec7e1753a dirstate.status: if a file is marked as copied, consider it modified
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4374
diff changeset
51 hg st -AC foo
de8ec7e1753a dirstate.status: if a file is marked as copied, consider it modified
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4374
diff changeset
52
1127
19b048da4da9 Fixed test-copy2 with only looking at copied files.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1117
diff changeset
53 exit 0