tests/test-commit
author Gilles Moris <gilles.moris@free.fr>
Fri, 22 Aug 2008 22:32:53 +0200
changeset 6935 03916abdfb64
parent 6934 abb915d9d8db
child 7072 4e0d54fbd34f
permissions -rwxr-xr-x
Have verbose and debug flag print the changeset rev and hash when committing. Besides updating the tests output, I had to push back at the end the test for issue1193 in test-commit, solved by cset 4386a7706828, because it was using the current date for commit and was randomizing the subsequent hash.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1196
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     1
#!/bin/sh
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     2
3709
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
     3
echo % commit date test
1196
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     4
hg init test
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     5
cd test
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     6
echo foo > foo
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     7
hg add foo
5754
75c2071385da Prompt for a commit message in editor, improve error message
Patrick Mezard <pmezard@gmail.com>
parents: 4253
diff changeset
     8
HGEDITOR=true hg commit -m ""
1196
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     9
hg commit -d '0 0' -m commit-1
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    10
echo foo >> foo
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    11
hg commit -d '1 4444444' -m commit-3
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    12
hg commit -d '1	15.1' -m commit-4
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    13
hg commit -d 'foo bar' -m commit-5
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    14
hg commit -d ' 1 4444' -m commit-6
3738e85ead07 Make date/timezone validation in changelog.add more robust. Add test.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    15
hg commit -d '111111111111 0' -m commit-7
1488
08c7851969cc only files in normal state should be marked as deleted
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1203
diff changeset
    16
6110
81e20e01d465 status: put added files that have disappeared in the deleted list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5754
diff changeset
    17
echo % commit added file that has been deleted
1488
08c7851969cc only files in normal state should be marked as deleted
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1203
diff changeset
    18
echo bar > bar
08c7851969cc only files in normal state should be marked as deleted
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1203
diff changeset
    19
hg add bar
08c7851969cc only files in normal state should be marked as deleted
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1203
diff changeset
    20
rm bar
6112
5ffa962783c4 cmdutil.commit: use relative paths in the error messages
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6110
diff changeset
    21
hg commit -d "1000000 0" -m commit-8
5ffa962783c4 cmdutil.commit: use relative paths in the error messages
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6110
diff changeset
    22
hg commit -d "1000000 0" -m commit-8-2 bar
3786
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    23
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    24
hg -q revert -a --no-backup
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    25
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    26
mkdir dir
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    27
echo boo > dir/file
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    28
hg add
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    29
hg -v commit -d '0 0' -m commit-9 dir
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    30
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    31
echo > dir.file
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    32
hg add
6112
5ffa962783c4 cmdutil.commit: use relative paths in the error messages
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6110
diff changeset
    33
hg commit -d '0 0' -m commit-10 dir dir.file
3786
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    34
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    35
echo >> dir/file
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    36
mkdir bleh
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    37
mkdir dir2
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    38
cd bleh
6112
5ffa962783c4 cmdutil.commit: use relative paths in the error messages
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6110
diff changeset
    39
hg commit -d '0 0' -m commit-11 .
5ffa962783c4 cmdutil.commit: use relative paths in the error messages
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6110
diff changeset
    40
hg commit -d '0 0' -m commit-12 ../dir ../dir2
3786
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    41
hg -v commit -d '0 0' -m commit-13 ../dir
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    42
cd ..
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    43
6112
5ffa962783c4 cmdutil.commit: use relative paths in the error messages
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6110
diff changeset
    44
hg commit -d '0 0' -m commit-14 does-not-exist
3786
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    45
ln -s foo baz
6112
5ffa962783c4 cmdutil.commit: use relative paths in the error messages
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6110
diff changeset
    46
hg commit -d '0 0' -m commit-15 baz
3786
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    47
touch quux
6112
5ffa962783c4 cmdutil.commit: use relative paths in the error messages
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6110
diff changeset
    48
hg commit -d '0 0' -m commit-16 quux
3786
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    49
echo >> dir/file
8d603f8567ae make hg commit <dirname> work again
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3709
diff changeset
    50
hg -v commit -d '0 0' -m commit-17 dir/file
6935
03916abdfb64 Have verbose and debug flag print the changeset rev and hash when committing.
Gilles Moris <gilles.moris@free.fr>
parents: 6934
diff changeset
    51
# An empty date was interpreted as epoch origin
03916abdfb64 Have verbose and debug flag print the changeset rev and hash when committing.
Gilles Moris <gilles.moris@free.fr>
parents: 6934
diff changeset
    52
echo foo >> foo
03916abdfb64 Have verbose and debug flag print the changeset rev and hash when committing.
Gilles Moris <gilles.moris@free.fr>
parents: 6934
diff changeset
    53
hg commit -d '' -m commit-no-date
03916abdfb64 Have verbose and debug flag print the changeset rev and hash when committing.
Gilles Moris <gilles.moris@free.fr>
parents: 6934
diff changeset
    54
hg tip --template '{date|isodate}\n' | grep '1970'
3709
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    55
cd ..
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    56
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    57
echo % partial subdir commit test
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    58
hg init test2
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    59
cd test2
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    60
mkdir foo
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    61
echo foo > foo/foo
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    62
mkdir bar
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    63
echo bar > bar/bar
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    64
hg add
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    65
hg ci -d '1000000 0' -u test -m commit-subdir-1 foo
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    66
hg ci -d '1000001 0' -u test -m commit-subdir-2 bar
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    67
echo % subdir log 1
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    68
hg log -v foo
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    69
echo % subdir log 2
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    70
hg log -v bar
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    71
echo % full log
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    72
hg log -v
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    73
cd ..
38291d9c8c1c Expand test-commit to cover one of the recent bugs.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 1933
diff changeset
    74
4253
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    75
echo % dot and subdir commit test
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    76
hg init test3
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    77
cd test3
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    78
mkdir foo
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    79
echo foo content > foo/plain-file
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    80
hg add foo/plain-file
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    81
hg ci -d '1000000 0' -u test -m commit-foo-subdir foo
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    82
echo modified foo content > foo/plain-file
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    83
hg ci -d '2000000 0' -u test -m commit-foo-dot .
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    84
echo % full log
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    85
hg log -v
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    86
echo % subdir log
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    87
cd foo
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    88
hg log .
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    89
cd ..
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    90
cd ..
9e3e975258a9 tests: expand test-commit a bit to test 'hg commit .' too
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3786
diff changeset
    91
6386
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
    92
cd ..
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
    93
hg init issue1049
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
    94
cd issue1049
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
    95
echo a > a
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
    96
hg ci -Ama
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
    97
echo a >> a
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
    98
hg ci -mb
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
    99
hg up 0
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
   100
echo b >> a
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
   101
hg ci -mc
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
   102
HGMERGE=true hg merge
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
   103
echo % should fail because we are specifying a file name
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
   104
hg ci -mmerge a
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
   105
echo % should fail because we are specifying a pattern
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
   106
hg ci -mmerge -I a
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
   107
echo % should succeed
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
   108
hg ci -mmerge
bae2e9c838e9 Tests for issue 1049
Bryan O'Sullivan <bos@serpentine.com>
parents: 6112
diff changeset
   109
1203
cb4c423cbb38 Get test-commit to exit cleanly.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1196
diff changeset
   110
exit 0