##// END OF EJS Templates
tests: add some testing for patch.diffstat()
Dirkjan Ochtman -
r7105:31837416 default
parent child Browse files
Show More
@@ -1,72 +1,86 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat <<EOF >> $HGRCPATH
3 cat <<EOF >> $HGRCPATH
4 [extensions]
4 [extensions]
5 notify=
5 notify=
6
6
7 [hooks]
7 [hooks]
8 incoming.notify = python:hgext.notify.hook
8 incoming.notify = python:hgext.notify.hook
9
9
10 [notify]
10 [notify]
11 sources = pull
11 sources = pull
12 diffstat = False
12 diffstat = False
13
13
14 [usersubs]
14 [usersubs]
15 foo@bar = *
15 foo@bar = *
16
16
17 [reposubs]
17 [reposubs]
18 * = baz
18 * = baz
19 EOF
19 EOF
20
20
21 hg help notify
21 hg help notify
22 hg init a
22 hg init a
23 echo a > a/a
23 echo a > a/a
24 echo % commit
24 echo % commit
25 hg --traceback --cwd a commit -Ama -d '0 0'
25 hg --traceback --cwd a commit -Ama -d '0 0'
26
26
27 echo % clone
27 echo % clone
28 hg --traceback clone a b
28 hg --traceback clone a b
29
29
30 echo a >> a/a
30 echo a >> a/a
31 echo % commit
31 echo % commit
32 hg --traceback --cwd a commit -Amb -d '1 0'
32 hg --traceback --cwd a commit -Amb -d '1 0'
33
33
34 # on Mac OS X 10.5 the tmp path is very long so would get stripped in the subject line
34 # on Mac OS X 10.5 the tmp path is very long so would get stripped in the subject line
35 cat <<EOF >> $HGRCPATH
35 cat <<EOF >> $HGRCPATH
36 [notify]
36 [notify]
37 maxsubject = 200
37 maxsubject = 200
38 EOF
38 EOF
39
39
40 # the python call below wraps continuation lines, which appear on Mac OS X 10.5 because
40 # the python call below wraps continuation lines, which appear on Mac OS X 10.5 because
41 # of the very long subject line
41 # of the very long subject line
42 echo '% pull (minimal config)'
42 echo '% pull (minimal config)'
43 hg --traceback --cwd b pull ../a 2>&1 |
43 hg --traceback --cwd b pull ../a 2>&1 |
44 python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),' |
44 python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),' |
45 sed -e 's/\(Message-Id:\).*/\1/' \
45 sed -e 's/\(Message-Id:\).*/\1/' \
46 -e 's/changeset \([0-9a-f]* *\)in .*test-notif/changeset \1in test-notif/' \
46 -e 's/changeset \([0-9a-f]* *\)in .*test-notif/changeset \1in test-notif/' \
47 -e 's/^details: .*test-notify/details: test-notify/' \
47 -e 's/^details: .*test-notify/details: test-notify/' \
48 -e 's/^Date:.*/Date:/'
48 -e 's/^Date:.*/Date:/'
49
49
50 cat <<EOF >> $HGRCPATH
50 cat <<EOF >> $HGRCPATH
51 [notify]
51 [notify]
52 config = $HGTMP/.notify.conf
52 config = $HGTMP/.notify.conf
53 domain = test.com
53 domain = test.com
54 strip = 3
54 strip = 3
55 template = Subject: {desc|firstline|strip}\nFrom: {author}\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip}
55 template = Subject: {desc|firstline|strip}\nFrom: {author}\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip}
56
56
57 [web]
57 [web]
58 baseurl = http://test/
58 baseurl = http://test/
59 EOF
59 EOF
60
60
61 echo % fail for config file is missing
61 echo % fail for config file is missing
62 hg --cwd b rollback
62 hg --cwd b rollback
63 hg --cwd b pull ../a 2>&1 | grep 'unable to open.*\.notify\.conf' > /dev/null && echo pull failed
63 hg --cwd b pull ../a 2>&1 | grep 'unable to open.*\.notify\.conf' > /dev/null && echo pull failed
64
64
65 touch "$HGTMP/.notify.conf"
65 touch "$HGTMP/.notify.conf"
66
66
67 echo % pull
67 echo % pull
68 hg --cwd b rollback
68 hg --cwd b rollback
69 hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \
69 hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \
70 -e 's/changeset \([0-9a-f]*\) in .*/changeset \1/' \
70 -e 's/changeset \([0-9a-f]*\) in .*/changeset \1/' \
71 -e 's/^Date:.*/Date:/'
71 -e 's/^Date:.*/Date:/'
72
72
73 cat << EOF >> $HGRCPATH
74 [hooks]
75 incoming.notify = python:hgext.notify.hook
76
77 [notify]
78 sources = pull
79 diffstat = True
80 EOF
81
82 echo % pull
83 hg --cwd b rollback
84 hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \
85 -e 's/changeset \([0-9a-f]*\) in .*/changeset \1/' \
86 -e 's/^Date:.*/Date:/'
@@ -1,66 +1,98 b''
1 notify extension - No help text available
1 notify extension - No help text available
2
2
3 no commands defined
3 no commands defined
4 % commit
4 % commit
5 adding a
5 adding a
6 % clone
6 % clone
7 updating working directory
7 updating working directory
8 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
8 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
9 % commit
9 % commit
10 % pull (minimal config)
10 % pull (minimal config)
11 pulling from ../a
11 pulling from ../a
12 searching for changes
12 searching for changes
13 adding changesets
13 adding changesets
14 adding manifests
14 adding manifests
15 adding file changes
15 adding file changes
16 added 1 changesets with 1 changes to 1 files
16 added 1 changesets with 1 changes to 1 files
17 Date:
17 Date:
18 Subject: changeset in test-notify/b: b
18 Subject: changeset in test-notify/b: b
19 From: test
19 From: test
20 X-Hg-Notification: changeset 0647d048b600
20 X-Hg-Notification: changeset 0647d048b600
21 Message-Id:
21 Message-Id:
22 To: baz, foo@bar
22 To: baz, foo@bar
23
23
24 changeset 0647d048b600 in test-notify/b
24 changeset 0647d048b600 in test-notify/b
25 details: test-notify/b?cmd=changeset;node=0647d048b600
25 details: test-notify/b?cmd=changeset;node=0647d048b600
26 description: b
26 description: b
27
27
28 diffs (6 lines):
28 diffs (6 lines):
29
29
30 diff -r cb9a9f314b8b -r 0647d048b600 a
30 diff -r cb9a9f314b8b -r 0647d048b600 a
31 --- a/a Thu Jan 01 00:00:00 1970 +0000
31 --- a/a Thu Jan 01 00:00:00 1970 +0000
32 +++ b/a Thu Jan 01 00:00:01 1970 +0000
32 +++ b/a Thu Jan 01 00:00:01 1970 +0000
33 @@ -1,1 +1,2 @@
33 @@ -1,1 +1,2 @@
34 a
34 a
35 +a
35 +a
36 (run 'hg update' to get a working copy)
36 (run 'hg update' to get a working copy)
37 % fail for config file is missing
37 % fail for config file is missing
38 rolling back last transaction
38 rolling back last transaction
39 pull failed
39 pull failed
40 % pull
40 % pull
41 rolling back last transaction
41 rolling back last transaction
42 pulling from ../a
42 pulling from ../a
43 searching for changes
43 searching for changes
44 adding changesets
44 adding changesets
45 adding manifests
45 adding manifests
46 adding file changes
46 adding file changes
47 added 1 changesets with 1 changes to 1 files
47 added 1 changesets with 1 changes to 1 files
48 Date:
48 Date:
49 Subject: b
49 Subject: b
50 From: test@test.com
50 From: test@test.com
51 X-Hg-Notification: changeset 0647d048b600
51 X-Hg-Notification: changeset 0647d048b600
52 Message-Id:
52 Message-Id:
53 To: baz@test.com, foo@bar
53 To: baz@test.com, foo@bar
54
54
55 changeset 0647d048b600
55 changeset 0647d048b600
56 description:
56 description:
57 b
57 b
58 diffs (6 lines):
58 diffs (6 lines):
59
59
60 diff -r cb9a9f314b8b -r 0647d048b600 a
60 diff -r cb9a9f314b8b -r 0647d048b600 a
61 --- a/a Thu Jan 01 00:00:00 1970 +0000
61 --- a/a Thu Jan 01 00:00:00 1970 +0000
62 +++ b/a Thu Jan 01 00:00:01 1970 +0000
62 +++ b/a Thu Jan 01 00:00:01 1970 +0000
63 @@ -1,1 +1,2 @@
63 @@ -1,1 +1,2 @@
64 a
64 a
65 +a
65 +a
66 (run 'hg update' to get a working copy)
66 (run 'hg update' to get a working copy)
67 % pull
68 rolling back last transaction
69 pulling from ../a
70 searching for changes
71 adding changesets
72 adding manifests
73 adding file changes
74 added 1 changesets with 1 changes to 1 files
75 Date:
76 Subject: b
77 From: test@test.com
78 X-Hg-Notification: changeset 0647d048b600
79 Message-Id:
80 To: baz@test.com, foo@bar
81
82 changeset 0647d048b600
83 description:
84 b
85 diffstat:
86
87 1 file changed, 1 insertion(+)
88 a | 1 +
89
90 diffs (6 lines):
91
92 diff -r cb9a9f314b8b -r 0647d048b600 a
93 --- a/a Thu Jan 01 00:00:00 1970 +0000
94 +++ b/a Thu Jan 01 00:00:01 1970 +0000
95 @@ -1,1 +1,2 @@
96 a
97 +a
98 (run 'hg update' to get a working copy)
General Comments 0
You need to be logged in to leave comments. Login now