diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
commit | cf46733632c7279a9fd0fe6ce26f9185a4ae82a9 (patch) | |
tree | da27775a2161723ef342e91af41a8b51fedef405 /tools/hook-scripts | |
parent | bb0ef45f7c46b0ae221b26265ef98a768c33f820 (diff) | |
download | subversion-tarball-cf46733632c7279a9fd0fe6ce26f9185a4ae82a9.tar.gz |
subversion-1.9.7HEADsubversion-1.9.7master
Diffstat (limited to 'tools/hook-scripts')
-rwxr-xr-x | tools/hook-scripts/commit-access-control.pl.in | 2 | ||||
-rwxr-xr-x | tools/hook-scripts/mailer/mailer.py | 38 | ||||
-rwxr-xr-x | tools/hook-scripts/mailer/tests/mailer-init.sh | 8 | ||||
-rwxr-xr-x | tools/hook-scripts/svn2feed.py | 2 | ||||
-rwxr-xr-x | tools/hook-scripts/svnperms.py | 2 |
5 files changed, 33 insertions, 19 deletions
diff --git a/tools/hook-scripts/commit-access-control.pl.in b/tools/hook-scripts/commit-access-control.pl.in index e2a968b..d30f23a 100755 --- a/tools/hook-scripts/commit-access-control.pl.in +++ b/tools/hook-scripts/commit-access-control.pl.in @@ -6,7 +6,7 @@ # commit in repository REPOS using the permissions listed in the # configuration file CONF_FILE. # -# $HeadURL: http://svn.apache.org/repos/asf/subversion/branches/1.8.x/tools/hook-scripts/commit-access-control.pl.in $ +# $HeadURL: https://svn.apache.org/repos/asf/subversion/branches/1.9.x/tools/hook-scripts/commit-access-control.pl.in $ # $LastChangedDate: 2009-11-16 19:07:17 +0000 (Mon, 16 Nov 2009) $ # $LastChangedBy: hwright $ # $LastChangedRevision: 880911 $ diff --git a/tools/hook-scripts/mailer/mailer.py b/tools/hook-scripts/mailer/mailer.py index 65146f1..fd41714 100755 --- a/tools/hook-scripts/mailer/mailer.py +++ b/tools/hook-scripts/mailer/mailer.py @@ -22,10 +22,10 @@ # # mailer.py: send email describing a commit # -# $HeadURL: http://svn.apache.org/repos/asf/subversion/branches/1.8.x/tools/hook-scripts/mailer/mailer.py $ -# $LastChangedDate: 2013-04-12 07:44:37 +0000 (Fri, 12 Apr 2013) $ +# $HeadURL: https://svn.apache.org/repos/asf/subversion/branches/1.9.x/tools/hook-scripts/mailer/mailer.py $ +# $LastChangedDate: 2015-02-13 11:17:40 +0000 (Fri, 13 Feb 2015) $ # $LastChangedBy: rhuijben $ -# $LastChangedRevision: 1467191 $ +# $LastChangedRevision: 1659509 $ # # USAGE: mailer.py commit REPOS REVISION [CONFIG-FILE] # mailer.py propchange REPOS REVISION AUTHOR REVPROPNAME [CONFIG-FILE] @@ -236,16 +236,30 @@ class MailedOutput(OutputBase): and self.reply_to[2] == ']': self.reply_to = self.reply_to[3:] + def _rfc2047_encode(self, hdr): + # Return the result of splitting HDR into tokens (on space + # characters), encoding (per RFC2047) each token as necessary, and + # slapping 'em back to together again. + from email.Header import Header + + def _maybe_encode_header(hdr_token): + try: + hdr_token.encode('ascii') + return hdr_token + except UnicodeError: + return Header(hdr_token, 'utf-8').encode() + + return ' '.join(map(_maybe_encode_header, hdr.split())) + def mail_headers(self, group, params): from email import Utils - subject = self.make_subject(group, params) - try: - subject.encode('ascii') - except UnicodeError: - from email.Header import Header - subject = Header(subject, 'utf-8').encode() - hdrs = 'From: %s\n' \ - 'To: %s\n' \ + + subject = self._rfc2047_encode(self.make_subject(group, params)) + from_hdr = self._rfc2047_encode(self.from_addr) + to_hdr = self._rfc2047_encode(', '.join(self.to_addrs)) + + hdrs = 'From: %s\n' \ + 'To: %s\n' \ 'Subject: %s\n' \ 'Date: %s\n' \ 'Message-ID: %s\n' \ @@ -256,7 +270,7 @@ class MailedOutput(OutputBase): 'X-Svn-Commit-Author: %s\n' \ 'X-Svn-Commit-Revision: %d\n' \ 'X-Svn-Commit-Repository: %s\n' \ - % (self.from_addr, ', '.join(self.to_addrs), subject, + % (from_hdr, to_hdr, subject, Utils.formatdate(), Utils.make_msgid(), group, self.repos.author or 'no_author', self.repos.rev, os.path.basename(self.repos.repos_dir)) diff --git a/tools/hook-scripts/mailer/tests/mailer-init.sh b/tools/hook-scripts/mailer/tests/mailer-init.sh index ef961b4..d0a4a79 100755 --- a/tools/hook-scripts/mailer/tests/mailer-init.sh +++ b/tools/hook-scripts/mailer/tests/mailer-init.sh @@ -101,15 +101,15 @@ echo change C6 >> dir6/file4 svn commit -m "copy dir, then make a change" # add a binary file and set property to binary value -echo -e "\x00\x01\x02\x03\x04" > file11 +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 ps prop2 -F file11 file9 svn commit -m "add binary file" # change the binary file and set property to non binary value -echo -e "\x20\x01\x02\x20" > file11 -svn ps prop2 propval2 file9 +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 diff --git a/tools/hook-scripts/svn2feed.py b/tools/hook-scripts/svn2feed.py index b4ba2ac..ecb8605 100755 --- a/tools/hook-scripts/svn2feed.py +++ b/tools/hook-scripts/svn2feed.py @@ -70,7 +70,7 @@ Options: # is actually set only on initial feed creation, and thereafter simply # re-used from the pickle each time. -# $HeadURL: http://svn.apache.org/repos/asf/subversion/branches/1.8.x/tools/hook-scripts/svn2feed.py $ +# $HeadURL: https://svn.apache.org/repos/asf/subversion/branches/1.9.x/tools/hook-scripts/svn2feed.py $ # $LastChangedDate: 2009-11-16 19:07:17 +0000 (Mon, 16 Nov 2009) $ # $LastChangedBy: hwright $ # $LastChangedRevision: 880911 $ diff --git a/tools/hook-scripts/svnperms.py b/tools/hook-scripts/svnperms.py index 14fbf7a..8fae998 100755 --- a/tools/hook-scripts/svnperms.py +++ b/tools/hook-scripts/svnperms.py @@ -21,7 +21,7 @@ # # -# $HeadURL: http://svn.apache.org/repos/asf/subversion/branches/1.8.x/tools/hook-scripts/svnperms.py $ +# $HeadURL: https://svn.apache.org/repos/asf/subversion/branches/1.9.x/tools/hook-scripts/svnperms.py $ # $LastChangedDate: 2011-07-12 18:37:44 +0000 (Tue, 12 Jul 2011) $ # $LastChangedBy: blair $ # $LastChangedRevision: 1145712 $ |