Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/test-notify @ 5378:8a2915f57dfc
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.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Thu, 04 Oct 2007 23:21:37 -0300 |
parents | 5371a213b0f4 |
children |
rev | line source |
---|---|
3740
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
1 #!/bin/sh |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
3 cat <<EOF >> $HGRCPATH |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
4 [extensions] |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
5 notify= |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
6 |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
7 [hooks] |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
8 incoming.notify = python:hgext.notify.hook |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
9 |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
10 [notify] |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
11 sources = pull |
3747
b5c4d749f37f
Fix test-notify for systems without or with a different version of diffstat.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3740
diff
changeset
|
12 diffstat = False |
3740
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
13 |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
14 [usersubs] |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
15 foo@bar = * |
4094
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
16 |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
17 [reposubs] |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
18 * = baz |
3740
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
19 EOF |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
20 |
4009
86098ec4b77a
fix hg help <ext> for extension that do not define any command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3747
diff
changeset
|
21 hg help notify |
3740
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
22 hg init a |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
23 echo a > a/a |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
24 echo % commit |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
25 hg --traceback --cwd a commit -Ama -d '0 0' |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
26 |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
27 echo % clone |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
28 hg --traceback clone a b |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
29 |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
30 echo a >> a/a |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
31 echo % commit |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
32 hg --traceback --cwd a commit -Amb -d '1 0' |
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
33 |
4094
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
34 echo '% pull (minimal config)' |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
35 hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \ |
4157
bfeff6dcac7a
Fix sed expression in test-notify to be more portable.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4106
diff
changeset
|
36 -e 's/changeset \([0-9a-f]* *\)in .*test-notif/changeset \1in test-notif/' \ |
4489
afa1f57ae484
Add sending date to notify message.
Mathieu Clabaut <mathieu.clabaut@gmail.com>
parents:
4157
diff
changeset
|
37 -e 's/^details: .*test-notify/details: test-notify/' \ |
afa1f57ae484
Add sending date to notify message.
Mathieu Clabaut <mathieu.clabaut@gmail.com>
parents:
4157
diff
changeset
|
38 -e 's/^Date:.*/Date:/' |
4094
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
39 |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
40 cat <<EOF >> $HGRCPATH |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
41 [notify] |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
42 config = $HGTMP/.notify.conf |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
43 domain = test.com |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
44 strip = 3 |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
45 template = Subject: {desc|firstline|strip}\nFrom: {author}\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip} |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
46 |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
47 [web] |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
48 baseurl = http://test/ |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
49 EOF |
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
50 |
4517
5371a213b0f4
ui: make readsections() abort when configuration cannot be read.
Patrick Mezard <pmezard@gmail.com>
parents:
4489
diff
changeset
|
51 echo % fail for config file is missing |
5371a213b0f4
ui: make readsections() abort when configuration cannot be read.
Patrick Mezard <pmezard@gmail.com>
parents:
4489
diff
changeset
|
52 hg --cwd b rollback |
5371a213b0f4
ui: make readsections() abort when configuration cannot be read.
Patrick Mezard <pmezard@gmail.com>
parents:
4489
diff
changeset
|
53 hg --cwd b pull ../a 2>&1 | grep 'unable to open.*\.notify\.conf' > /dev/null && echo pull failed |
5371a213b0f4
ui: make readsections() abort when configuration cannot be read.
Patrick Mezard <pmezard@gmail.com>
parents:
4489
diff
changeset
|
54 |
5371a213b0f4
ui: make readsections() abort when configuration cannot be read.
Patrick Mezard <pmezard@gmail.com>
parents:
4489
diff
changeset
|
55 touch "$HGTMP/.notify.conf" |
5371a213b0f4
ui: make readsections() abort when configuration cannot be read.
Patrick Mezard <pmezard@gmail.com>
parents:
4489
diff
changeset
|
56 |
3740
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
57 echo % pull |
4094
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
58 hg --cwd b rollback |
3740
aef384dbc731
add test for the notify extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
59 hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \ |
4489
afa1f57ae484
Add sending date to notify message.
Mathieu Clabaut <mathieu.clabaut@gmail.com>
parents:
4157
diff
changeset
|
60 -e 's/changeset \([0-9a-f]*\) in .*/changeset \1/' \ |
afa1f57ae484
Add sending date to notify message.
Mathieu Clabaut <mathieu.clabaut@gmail.com>
parents:
4157
diff
changeset
|
61 -e 's/^Date:.*/Date:/' |
4094
fbf0e9acfd83
notify: don't try to fix addresses if notify.domain is not set
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4009
diff
changeset
|
62 |