diff options
author | James McCoy <jamessan@debian.org> | 2018-07-31 22:26:52 -0400 |
---|---|---|
committer | James McCoy <jamessan@debian.org> | 2018-07-31 22:26:52 -0400 |
commit | e20a507113ff1126aeb4a97b806390ea377fe292 (patch) | |
tree | 0260b3a40387d7f994fbadaf22f1e9d3c080b09f /tools/hook-scripts/mailer/tests | |
parent | c64debffb81d2fa17e9a72af7199ccf88b3cc556 (diff) |
New upstream version 1.10.2
Diffstat (limited to 'tools/hook-scripts/mailer/tests')
-rwxr-xr-x | tools/hook-scripts/mailer/tests/mailer-init.sh | 116 | ||||
-rw-r--r-- | tools/hook-scripts/mailer/tests/mailer-t1.output | 751 | ||||
-rwxr-xr-x | tools/hook-scripts/mailer/tests/mailer-t1.sh | 60 | ||||
-rwxr-xr-x | tools/hook-scripts/mailer/tests/mailer-tweak.py | 66 | ||||
-rw-r--r-- | tools/hook-scripts/mailer/tests/mailer.conf | 365 |
5 files changed, 1358 insertions, 0 deletions
diff --git a/tools/hook-scripts/mailer/tests/mailer-init.sh b/tools/hook-scripts/mailer/tests/mailer-init.sh new file mode 100755 index 0000000..d0a4a79 --- /dev/null +++ b/tools/hook-scripts/mailer/tests/mailer-init.sh @@ -0,0 +1,116 @@ +#!/bin/sh +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# +# +# mailer-init.sh: create and initialize a repository for the mailer tests +# +# USAGE: ./mailer-init.sh +# + +scripts="`dirname $0`" +scripts="`cd $scripts && pwd`" + +d=$scripts/mailer-init.$$ +mkdir $d +cd $d +echo "test directory is: $d" + +svnadmin create repos +svn co file://`pwd`/repos wc +cd wc + +# create a bunch of dirs and files +mkdir dir1 dir2 +echo file1 > file1 +echo file2 > file2 +echo file3 > dir1/file3 +echo file4 > dir1/file4 +echo file5 > dir2/file5 +echo file6 > dir2/file6 +svn add * +svn commit -m "initial load" + +# make some changes and set some properties +svn ps prop1 propval1 file1 +echo change C1 >> file2 +svn ps svn:keywords Id file2 +svn ps --force svn:new_svn_prop val file2 +svn ps prop1 propval1 file2 +svn ps prop3 propval3 dir1 +echo change C2 >> dir2/file5 +svn commit -m "two file changes. Fixes Blah#123" + +# copy a file and a dir and change property +svn cp file1 dir2/file7 +svn cp dir1 dir3 +svn ps prop3 propval4 dir3 +svn commit -m "two copies" + +# copy and modify a file +svn cp file1 dir3/file8 +echo change C3 >> dir3/file8 +svn commit -m "copied and changed" + +# change and delete properties +svn ps svn:keywords Date file2 +svn ps prop2 propval2 file2 +svn pd prop1 file2 +svn pd svn:new_svn_prop file2 +svn ps prop3 propval4 dir1 +svn pd prop3 dir3 +svn up # make sure our dirs are up to date +svn commit -m "changes and deletes of properties" + +# add a file, add a dir, and make a change +echo file9 > file9 +svn add file9 +svn mkdir dir4 +echo change C4 >> dir1/file3 +svn commit -m "mixed addition and change. Fixes Blaz#456 Blah#987" + +# add a file, add a dir, delete a file, delete a dir, and make a change +echo file10 > dir1/file10 +svn add dir1/file10 +svn mkdir dir3/dir5 +svn rm file2 dir2 +echo change C5 >> dir3/file3 +svn up # make sure our dirs are up to date +svn commit -m "adds, deletes, and a change" + +# copy a dir and change a file in it +svn cp dir3 dir6 +echo change C6 >> dir6/file4 +svn commit -m "copy dir, then make a change" + +# add a binary file and set property to binary value +printf "\x00\x01\x02\x03\x04\n" > file11 +svn add file11 +svn ps svn:mime-type application/octect-stream file11 +svn ps prop2 -F file11 file9 +svn commit -m "add binary file" + +# change the binary file and set property to non binary value +printf "\x20\x01\x02\x20\n" > file11 +svn ps prop2 propval2 file9 +svn commit -m "change binary file" + +# tweak the commit dates to known quantities +$scripts/mailer-tweak.py ../repos diff --git a/tools/hook-scripts/mailer/tests/mailer-t1.output b/tools/hook-scripts/mailer/tests/mailer-t1.output new file mode 100644 index 0000000..10466ff --- /dev/null +++ b/tools/hook-scripts/mailer/tests/mailer-t1.output @@ -0,0 +1,751 @@ +Group: file +Subject: r1 - dir1 dir2 + +Author: mailer test +Date: Sun Sep 9 01:46:40 2001 +New Revision: 1 + +Log: +initial load + +Added: + file1 + file2 + +Added: file1 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ file1 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file1 + +Added: file2 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ file2 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file2 +Group: file plus other areas +Subject: r1 - dir1 dir2 + +Author: mailer test +Date: Sun Sep 9 01:46:40 2001 +New Revision: 1 + +Log: +initial load + +Added: + file1 + file2 + +Changes in other areas also in this revision: +Added: + dir1/ + dir1/file3 + dir1/file4 + dir2/ + dir2/file5 + dir2/file6 + +Added: file1 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ file1 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file1 + +Added: file2 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ file2 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file2 + +Diffs of changes in other areas also in this revision: + +Added: dir1/file3 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir1/file3 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file3 + +Added: dir1/file4 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir1/file4 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file4 + +Added: dir2/file5 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir2/file5 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file5 + +Added: dir2/file6 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir2/file6 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file6 +Group: All +Subject: r1 - dir1 dir2 + +Author: mailer test +Date: Sun Sep 9 01:46:40 2001 +New Revision: 1 + +Log: +initial load + +Added: + dir1/ + dir1/file3 + dir1/file4 + dir2/ + dir2/file5 + dir2/file6 + file1 + file2 + +Added: dir1/file3 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir1/file3 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file3 + +Added: dir1/file4 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir1/file4 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file4 + +Added: dir2/file5 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir2/file5 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file5 + +Added: dir2/file6 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir2/file6 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file6 + +Added: file1 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ file1 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file1 + +Added: file2 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ file2 Sun Sep 9 01:46:40 2001 (r1) +@@ -0,0 +1 @@ ++file2 +Group: file +Subject: r2 - dir1 dir2 + +Author: mailer test +Date: Sun Sep 9 04:33:20 2001 +New Revision: 2 + +Log: +two file changes. Fixes Blah#123 + +Modified: + file1 (props changed) + file2 (contents, props changed) + +Modified: file2 +============================================================================== +--- file2 Sun Sep 9 01:46:40 2001 (r1) ++++ file2 Sun Sep 9 04:33:20 2001 (r2) +@@ -1 +1,2 @@ + file2 ++change C1 +Group: bugtracker +Subject: Fix for Blah#123: r2 - dir1 dir2 + +Author: mailer test +Date: Sun Sep 9 04:33:20 2001 +New Revision: 2 + +Log: +two file changes. Fixes Blah#123 + +Modified: + dir1/ (props changed) + dir2/file5 + file1 (props changed) + file2 (contents, props changed) + +Modified: dir2/file5 +============================================================================== +--- dir2/file5 Sun Sep 9 01:46:40 2001 (r1) ++++ dir2/file5 Sun Sep 9 04:33:20 2001 (r2) +@@ -1 +1,2 @@ + file5 ++change C2 + +Modified: file2 +============================================================================== +--- file2 Sun Sep 9 01:46:40 2001 (r1) ++++ file2 Sun Sep 9 04:33:20 2001 (r2) +@@ -1 +1,2 @@ + file2 ++change C1 +Group: All +Subject: r2 - dir1 dir2 + +Author: mailer test +Date: Sun Sep 9 04:33:20 2001 +New Revision: 2 + +Log: +two file changes. Fixes Blah#123 + +Modified: + dir1/ (props changed) + dir2/file5 + file1 (props changed) + file2 (contents, props changed) + +Modified: dir2/file5 +============================================================================== +--- dir2/file5 Sun Sep 9 01:46:40 2001 (r1) ++++ dir2/file5 Sun Sep 9 04:33:20 2001 (r2) +@@ -1 +1,2 @@ + file5 ++change C2 + +Modified: file2 +============================================================================== +--- file2 Sun Sep 9 01:46:40 2001 (r1) ++++ file2 Sun Sep 9 04:33:20 2001 (r2) +@@ -1 +1,2 @@ + file2 ++change C1 +Group: file plus other areas +Subject: r2 - dir1 dir2 + +Author: mailer test +Date: Sun Sep 9 04:33:20 2001 +New Revision: 2 + +Log: +two file changes. Fixes Blah#123 + +Modified: + file1 (props changed) + file2 (contents, props changed) + +Changes in other areas also in this revision: +Modified: + dir1/ (props changed) + dir2/file5 + +Modified: file2 +============================================================================== +--- file2 Sun Sep 9 01:46:40 2001 (r1) ++++ file2 Sun Sep 9 04:33:20 2001 (r2) +@@ -1 +1,2 @@ + file2 ++change C1 + +Diffs of changes in other areas also in this revision: + +Modified: dir2/file5 +============================================================================== +--- dir2/file5 Sun Sep 9 01:46:40 2001 (r1) ++++ dir2/file5 Sun Sep 9 04:33:20 2001 (r2) +@@ -1 +1,2 @@ + file5 ++change C2 +Group: All +Subject: r3 - dir2 dir3 + +Author: mailer test +Date: Sun Sep 9 07:20:00 2001 +New Revision: 3 + +Log: +two copies + +Added: + dir2/file7 + - copied unchanged from r2, file1 + dir3/ (props changed) + - copied from r2, dir1/ + +Copied: dir2/file7 (from r2, file1) +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir2/file7 Sun Sep 9 07:20:00 2001 (r3, copy of r2, file1) +@@ -0,0 +1 @@ ++file1 +Group: All +Subject: r4 - dir3 + +Author: mailer test +Date: Sun Sep 9 10:06:40 2001 +New Revision: 4 + +Log: +copied and changed + +Added: + dir3/file8 + - copied, changed from r2, file1 + +Copied and modified: dir3/file8 (from r2, file1) +============================================================================== +--- file1 Sun Sep 9 04:33:20 2001 (r2, copy source) ++++ dir3/file8 Sun Sep 9 10:06:40 2001 (r4) +@@ -1 +1,2 @@ + file1 ++change C3 +Group: file +Subject: r5 - dir1 dir3 + +Author: mailer test +Date: Sun Sep 9 12:53:20 2001 +New Revision: 5 + +Log: +changes and deletes of properties + +Modified: + file2 (props changed) +Group: file plus other areas +Subject: r5 - dir1 dir3 + +Author: mailer test +Date: Sun Sep 9 12:53:20 2001 +New Revision: 5 + +Log: +changes and deletes of properties + +Modified: + file2 (props changed) + +Changes in other areas also in this revision: +Modified: + dir1/ (props changed) + dir3/ (props changed) +Group: All +Subject: r5 - dir1 dir3 + +Author: mailer test +Date: Sun Sep 9 12:53:20 2001 +New Revision: 5 + +Log: +changes and deletes of properties + +Modified: + dir1/ (props changed) + dir3/ (props changed) + file2 (props changed) +Group: file +Subject: r6 - dir1 dir4 + +Author: mailer test +Date: Sun Sep 9 15:40:00 2001 +New Revision: 6 + +Log: +mixed addition and change. Fixes Blaz#456 Blah#987 + +Added: + file9 + +Added: file9 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ file9 Sun Sep 9 15:40:00 2001 (r6) +@@ -0,0 +1 @@ ++file9 +Group: file plus other areas +Subject: r6 - dir1 dir4 + +Author: mailer test +Date: Sun Sep 9 15:40:00 2001 +New Revision: 6 + +Log: +mixed addition and change. Fixes Blaz#456 Blah#987 + +Added: + file9 + +Changes in other areas also in this revision: +Added: + dir4/ +Modified: + dir1/file3 + +Added: file9 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ file9 Sun Sep 9 15:40:00 2001 (r6) +@@ -0,0 +1 @@ ++file9 + +Diffs of changes in other areas also in this revision: + +Modified: dir1/file3 +============================================================================== +--- dir1/file3 Sun Sep 9 12:53:20 2001 (r5) ++++ dir1/file3 Sun Sep 9 15:40:00 2001 (r6) +@@ -1 +1,2 @@ + file3 ++change C4 +Group: bugtracker +Subject: Fix for Blaz#456: r6 - dir1 dir4 + +Author: mailer test +Date: Sun Sep 9 15:40:00 2001 +New Revision: 6 + +Log: +mixed addition and change. Fixes Blaz#456 Blah#987 + +Added: + dir4/ + file9 +Modified: + dir1/file3 + +Modified: dir1/file3 +============================================================================== +--- dir1/file3 Sun Sep 9 12:53:20 2001 (r5) ++++ dir1/file3 Sun Sep 9 15:40:00 2001 (r6) +@@ -1 +1,2 @@ + file3 ++change C4 + +Added: file9 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ file9 Sun Sep 9 15:40:00 2001 (r6) +@@ -0,0 +1 @@ ++file9 +Group: bugtracker +Subject: Fix for Blah#987: r6 - dir1 dir4 + +Author: mailer test +Date: Sun Sep 9 15:40:00 2001 +New Revision: 6 + +Log: +mixed addition and change. Fixes Blaz#456 Blah#987 + +Added: + dir4/ + file9 +Modified: + dir1/file3 + +Modified: dir1/file3 +============================================================================== +--- dir1/file3 Sun Sep 9 12:53:20 2001 (r5) ++++ dir1/file3 Sun Sep 9 15:40:00 2001 (r6) +@@ -1 +1,2 @@ + file3 ++change C4 + +Added: file9 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ file9 Sun Sep 9 15:40:00 2001 (r6) +@@ -0,0 +1 @@ ++file9 +Group: All +Subject: r6 - dir1 dir4 + +Author: mailer test +Date: Sun Sep 9 15:40:00 2001 +New Revision: 6 + +Log: +mixed addition and change. Fixes Blaz#456 Blah#987 + +Added: + dir4/ + file9 +Modified: + dir1/file3 + +Modified: dir1/file3 +============================================================================== +--- dir1/file3 Sun Sep 9 12:53:20 2001 (r5) ++++ dir1/file3 Sun Sep 9 15:40:00 2001 (r6) +@@ -1 +1,2 @@ + file3 ++change C4 + +Added: file9 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ file9 Sun Sep 9 15:40:00 2001 (r6) +@@ -0,0 +1 @@ ++file9 +Group: file +Subject: r7 - dir1 dir2 dir3 dir3/dir5 + +Author: mailer test +Date: Sun Sep 9 18:26:40 2001 +New Revision: 7 + +Log: +adds, deletes, and a change + +Deleted: + file2 + +Deleted: file2 +============================================================================== +--- file2 Sun Sep 9 18:26:40 2001 (r6) ++++ /dev/null 00:00:00 1970 (deleted) +@@ -1,2 +0,0 @@ +-file2 +-change C1 +Group: file plus other areas +Subject: r7 - dir1 dir2 dir3 dir3/dir5 + +Author: mailer test +Date: Sun Sep 9 18:26:40 2001 +New Revision: 7 + +Log: +adds, deletes, and a change + +Deleted: + file2 + +Changes in other areas also in this revision: +Added: + dir1/file10 + dir3/dir5/ +Deleted: + dir2/ +Modified: + dir3/file3 + +Deleted: file2 +============================================================================== +--- file2 Sun Sep 9 18:26:40 2001 (r6) ++++ /dev/null 00:00:00 1970 (deleted) +@@ -1,2 +0,0 @@ +-file2 +-change C1 + +Diffs of changes in other areas also in this revision: + +Added: dir1/file10 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir1/file10 Sun Sep 9 18:26:40 2001 (r7) +@@ -0,0 +1 @@ ++file10 + +Modified: dir3/file3 +============================================================================== +--- dir3/file3 Sun Sep 9 15:40:00 2001 (r6) ++++ dir3/file3 Sun Sep 9 18:26:40 2001 (r7) +@@ -1 +1,2 @@ + file3 ++change C5 +Group: All +Subject: r7 - dir1 dir2 dir3 dir3/dir5 + +Author: mailer test +Date: Sun Sep 9 18:26:40 2001 +New Revision: 7 + +Log: +adds, deletes, and a change + +Added: + dir1/file10 + dir3/dir5/ +Deleted: + dir2/ + file2 +Modified: + dir3/file3 + +Added: dir1/file10 +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir1/file10 Sun Sep 9 18:26:40 2001 (r7) +@@ -0,0 +1 @@ ++file10 + +Modified: dir3/file3 +============================================================================== +--- dir3/file3 Sun Sep 9 15:40:00 2001 (r6) ++++ dir3/file3 Sun Sep 9 18:26:40 2001 (r7) +@@ -1 +1,2 @@ + file3 ++change C5 + +Deleted: file2 +============================================================================== +--- file2 Sun Sep 9 18:26:40 2001 (r6) ++++ /dev/null 00:00:00 1970 (deleted) +@@ -1,2 +0,0 @@ +-file2 +-change C1 +Group: All +Subject: r8 - in dir6: . dir5 + +Author: mailer test +Date: Sun Sep 9 21:13:20 2001 +New Revision: 8 + +Log: +copy dir, then make a change + +Added: + dir6/ + - copied from r6, dir3/ + dir6/dir5/ + - copied from r7, dir3/dir5/ +Replaced: + dir6/file3 + - copied unchanged from r7, dir3/file3 +Modified: + dir6/file4 + +Copied: dir6/file3 (from r7, dir3/file3) +============================================================================== +--- /dev/null 00:00:00 1970 (empty, because file is newly added) ++++ dir6/file3 Sun Sep 9 21:13:20 2001 (r8, copy of r7, dir3/file3) +@@ -0,0 +1,2 @@ ++file3 ++change C5 + +Modified: dir6/file4 +============================================================================== +--- dir3/file4 Sun Sep 9 15:40:00 2001 (r6) ++++ dir6/file4 Sun Sep 9 21:13:20 2001 (r8) +@@ -1 +1,2 @@ + file4 ++change C6 +Group: file +Subject: r9 - + +Author: mailer test +Date: Mon Sep 10 00:00:00 2001 +New Revision: 9 + +Log: +add binary file + +Added: + file11 (contents, props changed) +Modified: + file9 (props changed) + +Added: file11 +============================================================================== +Binary file. No diff available. +Group: file plus other areas +Subject: r9 - + +Author: mailer test +Date: Mon Sep 10 00:00:00 2001 +New Revision: 9 + +Log: +add binary file + +Added: + file11 (contents, props changed) +Modified: + file9 (props changed) + +Added: file11 +============================================================================== +Binary file. No diff available. +Group: All +Subject: r9 - + +Author: mailer test +Date: Mon Sep 10 00:00:00 2001 +New Revision: 9 + +Log: +add binary file + +Added: + file11 (contents, props changed) +Modified: + file9 (props changed) + +Added: file11 +============================================================================== +Binary file. No diff available. +Group: file +Subject: r10 - + +Author: mailer test +Date: Mon Sep 10 02:46:40 2001 +New Revision: 10 + +Log: +change binary file + +Modified: + file11 + file9 (props changed) + +Modified: file11 +============================================================================== +Binary file (source and/or target). No diff available. +Group: file plus other areas +Subject: r10 - + +Author: mailer test +Date: Mon Sep 10 02:46:40 2001 +New Revision: 10 + +Log: +change binary file + +Modified: + file11 + file9 (props changed) + +Modified: file11 +============================================================================== +Binary file (source and/or target). No diff available. +Group: All +Subject: r10 - + +Author: mailer test +Date: Mon Sep 10 02:46:40 2001 +New Revision: 10 + +Log: +change binary file + +Modified: + file11 + file9 (props changed) + +Modified: file11 +============================================================================== +Binary file (source and/or target). No diff available. diff --git a/tools/hook-scripts/mailer/tests/mailer-t1.sh b/tools/hook-scripts/mailer/tests/mailer-t1.sh new file mode 100755 index 0000000..ff4b6ca --- /dev/null +++ b/tools/hook-scripts/mailer/tests/mailer-t1.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# +# +# mailer-t1.sh: test #1 for the mailer.py script +# +# This test generates "email" for each revision in the repository, +# concatenating them into one big blob, which is then compared against +# a known output. +# +# Note: mailer-tweak.py must have been run to make the test outputs +# consistent and reproducible +# +# USAGE: ./mailer-t1.sh REPOS MAILER-SCRIPT +# + +if test "$#" != 2; then + echo "USAGE: ./mailer-t1.sh REPOS MAILER-SCRIPT" + exit 1 +fi + +scripts="`dirname $0`" +scripts="`cd $scripts && pwd`" + +glom=$scripts/mailer-t1.current +orig=$scripts/mailer-t1.output +conf=$scripts/mailer.conf +rm -f $glom + +export TZ=GST + +youngest="`svnlook youngest $1`" +for rev in `python -c "print(\" \".join(map(str, range(1,$youngest+1))))"`; do + $2 commit $1 $rev $conf >> $glom +done + +echo "current mailer.py output in: $glom" + +dos2unix $glom + +echo diff -q $orig $glom +diff -q $orig $glom && echo "SUCCESS: no differences detected" diff --git a/tools/hook-scripts/mailer/tests/mailer-tweak.py b/tools/hook-scripts/mailer/tests/mailer-tweak.py new file mode 100755 index 0000000..0805980 --- /dev/null +++ b/tools/hook-scripts/mailer/tests/mailer-tweak.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# +# +# mailer-tweak.py: tweak the svn:date and svn:author properties +# on all revisions +# +# We need constant dates and authors for the revisions so that we can +# consistently compare an output against a known quantity. +# +# USAGE: ./mailer-tweak.py REPOS +# + + +import sys +import os +import getopt + +from svn import fs, core + +DATE_BASE = 1000000000 +DATE_INCR = 10000 + + +def tweak_dates(pool, home='.'): + db_path = os.path.join(home, 'db') + if not os.path.exists(db_path): + db_path = home + + fsob = fs.new(None, pool) + fs.open_berkeley(fsob, db_path) + + for i in range(fs.youngest_rev(fsob, pool)): + # convert secs into microseconds, then a string + date = core.svn_time_to_cstring((DATE_BASE+i*DATE_INCR) * 1000000L, pool) + #print date + fs.change_rev_prop(fsob, i+1, core.SVN_PROP_REVISION_DATE, date, pool) + fs.change_rev_prop(fsob, i+1, core.SVN_PROP_REVISION_AUTHOR, 'mailer test', pool) + +def main(): + if len(sys.argv) != 2: + print('USAGE: %s REPOS' % sys.argv[0]) + sys.exit(1) + + core.run_app(tweak_dates, sys.argv[1]) + +if __name__ == '__main__': + main() diff --git a/tools/hook-scripts/mailer/tests/mailer.conf b/tools/hook-scripts/mailer/tests/mailer.conf new file mode 100644 index 0000000..ac25f24 --- /dev/null +++ b/tools/hook-scripts/mailer/tests/mailer.conf @@ -0,0 +1,365 @@ +# +# mailer.conf: example configuration file for mailer.py +# +# $Id: mailer.conf 1086097 2011-03-28 02:14:33Z gmcdonald $ + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +[general] + +# The [general].diff option is now DEPRECATED. +# Instead use [defaults].diff . + +# +# One delivery method must be chosen. mailer.py will prefer using the +# "mail_command" option. If that option is empty or commented out, +# then it checks whether the "smtp_hostname" option has been +# specified. If neither option is set, then the commit message is +# delivered to stdout. +# + +# This command will be invoked with destination addresses on the command +# line, and the message piped into it. +#mail_command = /usr/sbin/sendmail + +# This option specifies the hostname for delivery via SMTP. +#smtp_hostname = localhost + +# Username and password for SMTP servers requiring authorisation. +#smtp_username = example +#smtp_password = example + +# -------------------------------------------------------------------------- + +# +# CONFIGURATION GROUPS +# +# Any sections other than [general], [defaults], [maps] and sections +# referred to within [maps] are considered to be user-defined groups +# which override values in the [defaults] section. +# These groups are selected using the following two options: +# +# for_repos +# for_paths +# +# Both options specify a regular expression. The former is matched against +# the absolute path to the repository the mailer is operating against. The +# second is matched against *every* path (files and dirs) that was modified +# during the commit. +# +# The options specified in the [defaults] section are always selected. The +# presence of a non-matching for_repos has no relevance. Note that you may +# still use a for_repos value to extract useful information (more on this +# later). Any user-defined groups without a for_repos, or which contains +# a matching for_repos, will be selected for potential use. +# +# The subset of user-defined groups identified by the repository are further +# refined based on the for_paths option. A group is selected if at least +# one path(*) in the commit matches the for_paths regular expression. Note +# that the paths are relative to the root of the repository and do not +# have a leading slash. +# +# (*) Actually, each path will select just one group. Thus, it is possible +# that one group will match against all paths, while another group matches +# none of the paths, even though its for_paths would have selected some of +# the paths in the commit. +# +# Groups are matched in no particular order. Do not depend upon their +# order within this configuration file. The values from [defaults] will +# be used if no group is matched or an option in a group does not override +# the corresponding value from [defaults]. +# +# Generally, a commit email is generated for each group that has been +# selected. The script will try to minimize mails, so it may be possible +# that a single message will be generated to multiple recipients. In +# addition, it is possible for multiple messages per group to be generated, +# based on the various substitutions that are performed (see the following +# section). +# +# +# SUBSTITUTIONS +# +# The regular expressions can use the "named group" syntax to extract +# interesting pieces of the repository or commit path. These named values +# can then be substituted in the option values during mail generation. +# +# For example, let's say that you have a repository with a top-level +# directory named "clients", with several client projects underneath: +# +# REPOS/ +# clients/ +# gsvn/ +# rapidsvn/ +# winsvn/ +# +# The client name can be extracted with a regular expression like: +# +# for_paths = clients/(?P<client>[^/]*)($|/) +# +# The substitution is performed using Python's dict-based string +# interpolation syntax: +# +# to_addr = commits@%(client)s.tigris.org +# +# The %(NAME)s syntax will substitute whatever value for NAME was captured +# in the for_repos and for_paths regular expressions. The set of names +# available is obtained from the following set of regular expressions: +# +# [defaults].for_repos (if present) +# [GROUP].for_repos (if present in the user-defined group "GROUP") +# [GROUP].for_paths (if present in the user-defined group "GROUP") +# +# The names from the regexes later in the list override the earlier names. +# If none of the groups match, but a for_paths is present in [defaults], +# then its extracted names will be available. +# +# Note that each unique set of names for substitution will generate an +# email. In the above example, if a commit modified files in all three +# client subdirectories, then an email will be sent to all three commits@ +# mailing lists on tigris.org. +# +# The substitution variable "author" is provided by default, and is set +# to the author name passed to mailer.py for revprop changes or the +# author defined for a revision; if neither is available, then it is +# set to "no_author". Thus, you might define a line like: +# +# from_addr = %(author)s@example.com +# +# +# SUMMARY +# +# While mailer.py will work to minimize the number of mail messages +# generated, a single commit can potentially generate a large number +# of variants of a commit message. The criteria for generating messages +# is based on: +# +# groups selected by for_repos +# groups selected by for_paths +# unique sets of parameters extracted by the above regular expressions +# + +[defaults] + +# This is not passed to the shell, so do not use shell metacharacters. +# The command is split around whitespace, so if you want to include +# whitespace in the command, then ### something ###. +diff = /usr/bin/diff -u -L %(label_from)s -L %(label_to)s %(from)s %(to)s + +# The default prefix for the Subject: header for commits. +commit_subject_prefix = + +# The default prefix for the Subject: header for propchanges. +propchange_subject_prefix = + +# The default prefix for the Subject: header for locks. +lock_subject_prefix = + +# The default prefix for the Subject: header for unlocks. +unlock_subject_prefix = + + +# The default From: address for messages. If the from_addr is not +# specified or it is specified but there is no text after the `=', +# then the revision's author is used as the from address. If the +# revision author is not specified, such as when a commit is done +# without requiring authentication and authorization, then the string +# 'no_author' is used. You can specify a default from_addr here and +# if you want to have a particular for_repos group use the author as +# the from address, you can use "from_addr =". +from_addr = invalid@example.com + +# The default To: addresses for message. One or more addresses, +# separated by whitespace (no commas). +# NOTE: If you want to use a different character for separating the +# addresses put it in front of the addresses included in square +# brackets '[ ]'. +to_addr = invalid@example.com + +# If this is set, then a Reply-To: will be inserted into the message. +reply_to = + +# Specify which types of repository changes mailer.py will create +# diffs for. Valid options are any combination of +# 'add copy modify delete', or 'none' to never create diffs. +# If the generate_diffs option is empty, the selection is controlled +# by the deprecated options suppress_deletes and suppress_adds. +# Note that this only affects the display of diffs - all changes are +# mentioned in the summary of changed paths at the top of the message, +# regardless of this option's value. +# Meaning of the possible values: +# add: generates diffs for all added paths +# copy: generates diffs for all copied paths +# which were not changed after copying +# modify: generates diffs for all modified paths, including paths that were +# copied and modified afterwards (within the same commit) +# delete: generates diffs for all removed paths +generate_diffs = add copy modify delete + +# Commit URL construction. This adds a URL to the top of the message +# that can lead the reader to a Trac, ViewVC or other view of the +# commit as a whole. +# +# The available substitution variable is: rev +#commit_url = http://diffs.server.com/trac/software/changeset/%(rev)s + +# Diff URL construction. For the configured diff URL types, the diff +# section (which follows the message header) will include the URL +# relevant to the change type, even if actual diff generation for that +# change type is disabled (per the generate_diffs option). +# +# Available substitution variables are: path, base_path, rev, base_rev +#diff_add_url = +#diff_copy_url = +#diff_modify_url = http://diffs.server.com/?p1=%(base_path)s&p2=%(path)s +#diff_delete_url = + +# When set to "yes", the mailer will suppress the creation of a diff which +# deletes all the lines in the file. If this is set to anything else, or +# is simply commented out, then the diff will be inserted. Note that the +# deletion is always mentioned in the message header, regardless of this +# option's value. +### DEPRECATED (if generate_diffs is not empty, this option is ignored) +#suppress_deletes = yes + +# When set to "yes", the mailer will suppress the creation of a diff which +# adds all the lines in the file. If this is set to anything else, or +# is simply commented out, then the diff will be inserted. Note that the +# addition is always mentioned in the message header, regardless of this +# option's value. +### DEPRECATED (if generate_diffs is not empty, this option is ignored) +#suppress_adds = yes + +# A revision is reported on if any of its changed paths match the +# for_paths option. If only some of the changed paths of a revision +# match, this variable controls the behaviour for the non-matching +# paths. Possible values are: +# +# yes: (Default) Show in both summary and diffs. +# summary: Show the changed paths in the summary, but omit the diffs. +# no: Show nothing more than a note saying "and changes in other areas" +# +show_nonmatching_paths = yes + +# Subject line length limit. The generated subject line will be truncated +# and terminated with "...", to remain within the specified maximum length. +# Set to 0 to turn off. +#truncate_subject = 200 + +# -------------------------------------------------------------------------- + +[maps] + +# +# This section can be used define rewrite mappings for option values. It +# is typically used for computing from/to addresses, but can actually be +# used to remap values for any option in this file. +# +# The mappings are global for the entire configuration file. There is +# no group-specific mapping capability. For each mapping that you want +# to perform, you will provide the name of the option (e.g. from_addr) +# and a specification of how to perform those mappings. These declarations +# are made here in the [maps] section. +# +# When an option is accessed, the value is loaded from the configuration +# file and all %(NAME)s substitutions are performed. The resulting value +# is then passed through the map. If a map entry is not available for +# the value, then it will be used unchanged. +# +# NOTES: - Avoid using map substitution names which differ only in case. +# Unexpected results may occur. +# - A colon ':' is also considered as separator between option and +# value (keep this in mind when trying to map a file path under +# windows). +# +# The format to declare a map is: +# +# option_name_to_remap = mapping_specification +# +# At the moment, there is only one type of mapping specification: +# +# mapping_specification = '[' sectionname ']' +# +# This will use the given section to map values. The option names in +# the section are the input values, and the option values are the result. +# + +# +# EXAMPLE: +# +# We have two projects using two repositories. The name of the repos +# does not easily map to their commit mailing lists, so we will use +# a mapping to go from a project name (extracted from the repository +# path) to their commit list. The committers also need a special +# mapping to derive their email address from their repository username. +# +# [projects] +# for_repos = .*/(?P<project>.*) +# from_addr = %(author)s +# to_addr = %(project)s +# +# [maps] +# from_addr = [authors] +# to_addr = [mailing-lists] +# +# [authors] +# john = jconnor@example.com +# sarah = sconnor@example.com +# +# [mailing-lists] +# t600 = spottable-commits@example.com +# tx = hotness-commits@example.com +# + +# -------------------------------------------------------------------------- + +# +# [example-group] +# # send notifications if any web pages are changed +# for_paths = .*\.html +# # set a custom prefix +# commit_subject_prefix = [commit] +# propchange_subject_prefix = [propchange] +# # override the default, sending these elsewhere +# to_addr = www-commits@example.com +# # use the revision author as the from address +# from_addr = +# # use a custom diff program for this group +# diff = /usr/bin/my-diff -u -L %(label_from)s -L %(label_to)s %(from)s %(to)s +# +# [another-example] +# # commits to personal repositories should go to that person +# for_repos = /home/(?P<who>[^/]*)/repos +# to_addr = %(who)s@example.com +# + +[All] + +[file plus other areas] +for_paths = file.* + +[file] +for_paths = file.* +show_nonmatching_paths = no + +[bugtracker] +search_logmsg = (?P<bugid>(Blaz|Blah)#\d+) +to_addr = issue-tracker@example.com +commit_subject_prefix = Fix for %(bugid)s: + |