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