tests/test-committer
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 04 Oct 2007 23:21:37 -0300
changeset 5378 8a2915f57dfc
parent 4044 78a0dd93db0b
permissions -rwxr-xr-x
convert: add a mode where mercurial_sink skips empty revisions. The getchanges function of some converter_source classes can return some false positives. I.e. they sometimes claim that a file "foo" was changed in some revision, even though its contents are still the same. convert_svn is particularly bad, but I think this can also happen with convert_cvs and, at least in theory, with mercurial_source. For regular conversions this is not really a problem - as long as getfile returns the right contents, we'll get a converted revision with the right contents. But when we use --filemap, this could lead to superfluous revisions being converted. Instead of fixing every converter_source, I decided to change mercurial_sink to work around this problem. When --filemap is used, we're interested only in revisions that touch some specific files. If a revision doesn't change any of these files, then we're not interested in it (at least for revisions with a single parent; merges are special). For mercurial_sink, we abuse this property and rollback a commit if the manifest text hasn't changed. This avoids duplicating the logic from localrepo.filecommit to detect unchanged files.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2104
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
     1
#!/bin/sh
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
     2
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
     3
unset HGUSER
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
     4
EMAIL="My Name <myname@example.com>"
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
     5
export EMAIL
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
     6
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
     7
hg init test
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
     8
cd test
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
     9
touch asdf
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
    10
hg add asdf
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
    11
hg commit -d '1000000 0' -m commit-1
f1085d34d20d Add tests/test-committer
Andrew Thompson <andrewkt@aktzero.com>
parents:
diff changeset
    12
hg tip
3461
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    13
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    14
unset EMAIL
3721
98f2507c5551 only print a warning when no username is specified
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3461
diff changeset
    15
echo 1234 > asdf
3461
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    16
hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    17
hg tip
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    18
echo "[ui]" >> .hg/hgrc
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    19
echo "username = foobar <foo@bar.com>" >> .hg/hgrc
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    20
echo 12 > asdf
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    21
hg commit -d '1000000 0' -m commit-1
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    22
hg tip
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    23
echo 1 > asdf
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    24
hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1
8b55c0ba8048 makes username mandatory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2104
diff changeset
    25
hg tip
3721
98f2507c5551 only print a warning when no username is specified
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3461
diff changeset
    26
echo 123 > asdf
4044
78a0dd93db0b Abort on empty username so specifying a username can be forced.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3722
diff changeset
    27
echo "[ui]" > .hg/hgrc
78a0dd93db0b Abort on empty username so specifying a username can be forced.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3722
diff changeset
    28
echo "username = " >> .hg/hgrc
78a0dd93db0b Abort on empty username so specifying a username can be forced.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3722
diff changeset
    29
hg commit -d '1000000 0' -m commit-1
3721
98f2507c5551 only print a warning when no username is specified
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3461
diff changeset
    30
rm .hg/hgrc
3722
5191e2299d63 Make sed expression in test-committer compatible with GNU sed 3.x.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3721
diff changeset
    31
hg commit -d '1000000 0' -m commit-1 2>&1 | sed -e "s/'[^']*'/user@host/"