tests/test-copy2
author Martin Geisler <mg@lazybytes.net>
Sat, 14 Aug 2010 02:35:44 +0200
changeset 11858 934c7e91c126
parent 11152 e8d10d085f47
permissions -rwxr-xr-x
tests: unify test-bad-extension
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
4744
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
     5
echo "# should fail - foo is not managed"
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
     6
hg mv foo bar
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
     7
hg st -A
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
     8
hg add foo
4744
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
     9
echo "# dry-run; print a warning that this is not a real copy; foo is added"
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    10
hg mv --dry-run foo bar
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    11
hg st -A
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    12
echo "# should print a warning that this is not a real copy; bar is added"
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    13
hg mv foo bar
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    14
hg st -A
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    15
echo "# should print a warning that this is not a real copy; foo is added"
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    16
hg cp bar foo
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    17
hg rm -f bar
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    18
rm bar
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    19
hg st -A
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 4744
diff changeset
    20
hg commit -m1
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    21
11152
e8d10d085f47 cmdutil: Warn when trying to copy/rename --after to a nonexistant file.
Steve Losh <steve@stevelosh.com>
parents: 8167
diff changeset
    22
echo "# copy --after to a nonexistant target filename"
e8d10d085f47 cmdutil: Warn when trying to copy/rename --after to a nonexistant file.
Steve Losh <steve@stevelosh.com>
parents: 8167
diff changeset
    23
hg cp -A foo dummy
e8d10d085f47 cmdutil: Warn when trying to copy/rename --after to a nonexistant file.
Steve Losh <steve@stevelosh.com>
parents: 8167
diff changeset
    24
4744
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    25
echo "# dry-run; should show that foo is clean"
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    26
hg copy --dry-run foo bar
44e17f5029d0 Make hg add foo; hg mv foo bar work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4743
diff changeset
    27
hg st -A
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    28
echo "# should show copy"
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    29
hg copy foo bar
4743
719c402258ee test-copy2: use status -C instead of debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4677
diff changeset
    30
hg st -C
1117
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 "# shouldn't show copy"
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 4744
diff changeset
    33
hg commit -m2
4743
719c402258ee test-copy2: use status -C instead of debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4677
diff changeset
    34
hg st -C
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    35
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    36
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
    37
hg debugindex .hg/store/data/foo.i
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    38
hg debugrename bar
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    39
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    40
echo bleah > foo
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    41
echo quux > bar
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 4744
diff changeset
    42
hg commit -m3
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    43
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    44
echo "# should not be renamed"
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    45
hg debugrename bar
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    46
1249
a5355fa5e33a Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents: 1168
diff changeset
    47
hg copy -f foo bar
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    48
echo "# should show copy"
4743
719c402258ee test-copy2: use status -C instead of debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4677
diff changeset
    49
hg st -C
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 4744
diff changeset
    50
hg commit -m3
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    51
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    52
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
    53
hg debugindex .hg/store/data/bar.i
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    54
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
    55
hg debugindex .hg/store/data/foo.i
1117
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    56
hg debugrename bar
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    57
30ab5b8ee8ec fix some rename/copy bugs
mpm@selenic.com
parents:
diff changeset
    58
echo "# should show no copies"
4743
719c402258ee test-copy2: use status -C instead of debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4677
diff changeset
    59
hg st -C
1127
19b048da4da9 Fixed test-copy2 with only looking at copied files.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1117
diff changeset
    60
4376
de612b5f8d59 Make copy --after work for files that have been hg added.
Brendan Cully <brendan@kublai.com>
parents: 3853
diff changeset
    61
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
    62
cp bar baz
de612b5f8d59 Make copy --after work for files that have been hg added.
Brendan Cully <brendan@kublai.com>
parents: 3853
diff changeset
    63
hg add baz
de612b5f8d59 Make copy --after work for files that have been hg added.
Brendan Cully <brendan@kublai.com>
parents: 3853
diff changeset
    64
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
    65
hg st -C
de612b5f8d59 Make copy --after work for files that have been hg added.
Brendan Cully <brendan@kublai.com>
parents: 3853
diff changeset
    66
4677
de8ec7e1753a dirstate.status: if a file is marked as copied, consider it modified
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4376
diff changeset
    67
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: 4376
diff changeset
    68
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: 4376
diff changeset
    69
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: 4376
diff changeset
    70
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: 4376
diff changeset
    71
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: 4376
diff changeset
    72
1127
19b048da4da9 Fixed test-copy2 with only looking at copied files.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1117
diff changeset
    73
exit 0