You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2021/01/23 04:00:51 UTC

svn commit: r1885829 - in /subversion/branches/1.14.x: ./ STATUS tools/hook-scripts/mailer/mailer.py tools/hook-scripts/mailer/tests/mailer-t1.output tools/hook-scripts/mailer/tests/mailer-tweak.py

Author: svn-role
Date: Sat Jan 23 04:00:51 2021
New Revision: 1885829

URL: http://svn.apache.org/viewvc?rev=1885829&view=rev
Log:
Merge the r1884427 group from trunk:

 * r1884427, r1885557, r1885600, r1885656, r1885784, r1885785
   Make mailer.py work properly with Python 3.
   Justification:
     Hook scripts should support Python 3 on 1.14.x.
   Votes:
     +1: stsp, futatuki

Modified:
    subversion/branches/1.14.x/   (props changed)
    subversion/branches/1.14.x/STATUS
    subversion/branches/1.14.x/tools/hook-scripts/mailer/mailer.py
    subversion/branches/1.14.x/tools/hook-scripts/mailer/tests/mailer-t1.output
    subversion/branches/1.14.x/tools/hook-scripts/mailer/tests/mailer-tweak.py

Propchange: subversion/branches/1.14.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1884427,1885557,1885600,1885656,1885784-1885785

Modified: subversion/branches/1.14.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/STATUS?rev=1885829&r1=1885828&r2=1885829&view=diff
==============================================================================
--- subversion/branches/1.14.x/STATUS (original)
+++ subversion/branches/1.14.x/STATUS Sat Jan 23 04:00:51 2021
@@ -60,10 +60,3 @@ Veto-blocked changes:
 
 Approved changes:
 =================
-
- * r1884427, r1885557, r1885600, r1885656, r1885784, r1885785
-   Make mailer.py work properly with Python 3.
-   Justification:
-     Hook scripts should support Python 3 on 1.14.x.
-   Votes:
-     +1: stsp, futatuki

Modified: subversion/branches/1.14.x/tools/hook-scripts/mailer/mailer.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/tools/hook-scripts/mailer/mailer.py?rev=1885829&r1=1885828&r2=1885829&view=diff
==============================================================================
--- subversion/branches/1.14.x/tools/hook-scripts/mailer/mailer.py (original)
+++ subversion/branches/1.14.x/tools/hook-scripts/mailer/mailer.py Sat Jan 23 04:00:51 2021
@@ -46,25 +46,21 @@
 
 import os
 import sys
-try:
-  # Python >=3.0
+if sys.hexversion >= 0x3000000:
+  PY3 = True
   import configparser
-  from urllib.parse import quote as urllib_parse_quote
-except ImportError:
-  # Python <3.0
+  from urllib.parse import quote as _url_quote
+else:
+  PY3 = False
   import ConfigParser as configparser
-  from urllib import quote as urllib_parse_quote
+  from urllib import quote as  _url_quote
 import time
 import subprocess
-if sys.version_info[0] >= 3:
-  # Python >=3.0
-  from io import StringIO
-else:
-  # Python <3.0
-  from cStringIO import StringIO
+from io import BytesIO
 import smtplib
 import re
 import tempfile
+import codecs
 
 # Minimal version of Subversion's bindings required
 _MIN_SVN_VERSION = [1, 5, 0]
@@ -83,6 +79,28 @@ if _MIN_SVN_VERSION > [svn.core.SVN_VER_
     % ".".join([str(x) for x in _MIN_SVN_VERSION]))
   sys.exit(1)
 
+# Absorb difference between Python 2 and Python >= 3
+if PY3:
+  def to_bytes(x):
+    return x.encode('utf-8')
+
+  def to_str(x):
+    return x.decode('utf-8')
+
+  # We never use sys.stdin nor sys.stdout TextIOwrapper.
+  _stdin = sys.stdin.buffer
+  _stdout = sys.stdout.buffer
+else:
+  # Python 2
+  def to_bytes(x):
+    return x
+
+  def to_str(x):
+    return x
+
+  _stdin = sys.stdin
+  _stdout = sys.stdout
+
 
 SEPARATOR = '=' * 78
 
@@ -101,7 +119,10 @@ def main(pool, cmd, config_fname, repos_
     revision = int(cmd_args[0])
     author = cmd_args[1]
     propname = cmd_args[2]
-    action = (cmd == 'propchange2' and cmd_args[3] or 'A')
+    if cmd == 'propchange2' and cmd_args[3]:
+      action = cmd_args[3]
+    else:
+      action = 'A'
     repos = Repository(repos_dir, revision, pool)
     # Override the repos revision author with the author of the propchange
     repos.author = author
@@ -127,7 +148,7 @@ def main(pool, cmd, config_fname, repos_
 
 
 def remove_leading_slashes(path):
-  while path and path[0] == '/':
+  while path and path[0:1] == b'/':
     path = path[1:]
   return path
 
@@ -158,8 +179,16 @@ class OutputBase:
     except ValueError:
       truncate_subject = 0
 
-    if truncate_subject and len(subject) > truncate_subject:
-      subject = subject[:(truncate_subject - 3)] + "..."
+    # truncate subject as UTF-8 string.
+    # Note: there still exists an issue on combining characters.
+    if truncate_subject:
+      bsubject = to_bytes(subject)
+      if len(bsubject) > truncate_subject:
+        idx = truncate_subject - 2
+        while b'\x80' <= bsubject[idx-1:idx] <= b'\xbf':
+          idx -= 1
+        subject = to_str(bsubject[:idx-1]) + "..."
+
     return subject
 
   def start(self, group, params):
@@ -177,11 +206,15 @@ class OutputBase:
     representation."""
     raise NotImplementedError
 
-  def write(self, output):
+  def write_binary(self, output):
     """Override this method.
-    Append the literal text string OUTPUT to the output representation."""
+    Append the binary data OUTPUT to the output representation."""
     raise NotImplementedError
 
+  def write(self, output):
+    """Append the literal text string OUTPUT to the output representation."""
+    return self.write_binary(to_bytes(output))
+
   def run(self, cmd):
     """Override this method, if the default implementation is not sufficient.
     Execute CMD, writing the stdout produced to the output representation."""
@@ -192,7 +225,7 @@ class OutputBase:
 
     buf = pipe_ob.stdout.read(self._CHUNKSIZE)
     while buf:
-      self.write(buf)
+      self.write_binary(buf)
       buf = pipe_ob.stdout.read(self._CHUNKSIZE)
 
     # wait on the child so we don't end up with a billion zombies
@@ -234,7 +267,7 @@ class MailedOutput(OutputBase):
     # 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
+    from email.header import Header
 
     def _maybe_encode_header(hdr_token):
       try:
@@ -246,7 +279,7 @@ class MailedOutput(OutputBase):
     return ' '.join(map(_maybe_encode_header, hdr.split()))
 
   def mail_headers(self, group, params):
-    from email import Utils
+    from email import utils
 
     subject  = self._rfc2047_encode(self.make_subject(group, params))
     from_hdr = self._rfc2047_encode(self.from_addr)
@@ -265,7 +298,7 @@ class MailedOutput(OutputBase):
            'X-Svn-Commit-Revision: %d\n' \
            'X-Svn-Commit-Repository: %s\n' \
            % (from_hdr, to_hdr, subject,
-              Utils.formatdate(), Utils.make_msgid(), group,
+              utils.formatdate(), utils.make_msgid(), group,
               self.repos.author or 'no_author', self.repos.rev,
               os.path.basename(self.repos.repos_dir))
     if self.reply_to:
@@ -279,8 +312,8 @@ class SMTPOutput(MailedOutput):
   def start(self, group, params):
     MailedOutput.start(self, group, params)
 
-    self.buffer = StringIO()
-    self.write = self.buffer.write
+    self.buffer = BytesIO()
+    self.write_binary = self.buffer.write
 
     self.write(self.mail_headers(group, params))
 
@@ -359,7 +392,7 @@ class StandardOutput(OutputBase):
 
   def __init__(self, cfg, repos, prefix_param):
     OutputBase.__init__(self, cfg, repos, prefix_param)
-    self.write = sys.stdout.write
+    self.write_binary = _stdout.write
 
   def start(self, group, params):
     self.write("Group: " + (group or "defaults") + "\n")
@@ -368,6 +401,12 @@ class StandardOutput(OutputBase):
   def finish(self):
     pass
 
+  if (PY3 and (codecs.lookup(sys.stdout.encoding) != codecs.lookup('utf-8'))):
+    def write(self, output):
+      """Write text as *default* encoding string"""
+      return self.write_binary(output.encode(sys.stdout.encoding,
+                                             'backslashreplace'))
+
 
 class PipeOutput(MailedOutput):
   "Deliver a mail message to an MTA via a pipe."
@@ -388,7 +427,7 @@ class PipeOutput(MailedOutput):
     # construct the pipe for talking to the mailer
     self.pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE,
                                  close_fds=sys.platform != "win32")
-    self.write = self.pipe.stdin.write
+    self.write_binary = self.pipe.stdin.write
 
     # start writing out the mail message
     self.write(self.mail_headers(group, params))
@@ -429,7 +468,7 @@ class Commit(Messenger):
 
     self.changelist = sorted(editor.get_changes().items())
 
-    log = repos.get_rev_prop(svn.core.SVN_PROP_REVISION_LOG) or ''
+    log = to_str(repos.get_rev_prop(svn.core.SVN_PROP_REVISION_LOG) or b'')
 
     # collect the set of groups and the unique sets of params for the options
     self.groups = { }
@@ -448,6 +487,7 @@ class Commit(Messenger):
     # figure out the changed directories
     dirs = { }
     for path, change in self.changelist:
+      path = to_str(path)
       if change.item_kind == svn.core.svn_node_dir:
         dirs[path] = None
       else:
@@ -484,7 +524,7 @@ class Commit(Messenger):
     # build a renderer, tied to our output stream
     renderer = TextCommitRenderer(self.output)
 
-    for (group, param_tuple), (params, paths) in self.groups.items():
+    for (group, param_tuple), (params, paths) in sorted(self.groups.items()):
       try:
         self.output.start(group, params)
 
@@ -538,7 +578,7 @@ class PropChange(Messenger):
         elif self.action == 'M':
           self.output.write('Property diff:\n')
           tempfile1 = tempfile.NamedTemporaryFile()
-          tempfile1.write(sys.stdin.read())
+          tempfile1.write(_stdin.read())
           tempfile1.flush()
           tempfile2 = tempfile.NamedTemporaryFile()
           tempfile2.write(self.repos.get_rev_prop(self.propname))
@@ -600,7 +640,7 @@ class Lock(Messenger):
                         or 'unlock_subject_prefix'))
 
     # read all the locked paths from STDIN and strip off the trailing newlines
-    self.dirlist = [x.rstrip() for x in sys.stdin.readlines()]
+    self.dirlist = [to_str(x).rstrip() for x in _stdin.readlines()]
 
     # collect the set of groups and the unique sets of params for the options
     self.groups = { }
@@ -629,11 +669,12 @@ class Lock(Messenger):
     # The lock comment is the same for all paths, so we can just pull
     # the comment for the first path in the dirlist and cache it.
     self.lock = svn.fs.svn_fs_get_lock(self.repos.fs_ptr,
-                                       self.dirlist[0], self.pool)
+                                       to_bytes(self.dirlist[0]),
+                                       self.pool)
 
   def generate(self):
     ret = 0
-    for (group, param_tuple), (params, paths) in self.groups.items():
+    for (group, param_tuple), (params, paths) in sorted(self.groups.items()):
       try:
         self.output.start(group, params)
 
@@ -702,9 +743,9 @@ class DiffURLSelections:
     # parameters for the configuration module, otherwise we may get
     # KeyError exceptions.
     params = self.params.copy()
-    params['path'] = change.path and urllib_parse_quote(change.path) or None
-    params['base_path'] = change.base_path and urllib_parse_quote(change.base_path) \
-                          or None
+    params['path'] = _url_quote(change.path) if change.path else None
+    params['base_path'] = (_url_quote(change.base_path)
+                           if change.base_path else None)
     params['rev'] = repos_rev
     params['base_rev'] = change.base_rev
 
@@ -758,7 +799,7 @@ def generate_content(renderer, cfg, repo
     author=repos.author,
     date=date,
     rev=repos.rev,
-    log=repos.get_rev_prop(svn.core.SVN_PROP_REVISION_LOG) or '',
+    log=to_str(repos.get_rev_prop(svn.core.SVN_PROP_REVISION_LOG) or b''),
     commit_url=commit_url,
     added_data=generate_list('A', changelist, paths, True),
     replaced_data=generate_list('R', changelist, paths, True),
@@ -866,7 +907,9 @@ class DiffGenerator:
 
       # figure out if/how to generate a diff
 
-      base_path = remove_leading_slashes(change.base_path)
+      base_path_bytes = remove_leading_slashes(change.base_path)
+      base_path = (to_str(base_path_bytes)
+                   if base_path_bytes is not None else None)
       if change.action == svn.repos.CHANGE_ACTION_DELETE:
         # it was delete.
         kind = 'D'
@@ -877,7 +920,7 @@ class DiffGenerator:
         # show the diff?
         if self.diffsels.delete:
           diff = svn.fs.FileDiff(self.repos.get_root(change.base_rev),
-                                 base_path, None, None, self.pool)
+                                 base_path_bytes, None, None, self.pool)
 
           label1 = '%s\t%s\t(r%s)' % (base_path, self.date, change.base_rev)
           label2 = '/dev/null\t00:00:00 1970\t(deleted)'
@@ -898,13 +941,13 @@ class DiffGenerator:
             # show the diff?
             if self.diffsels.modify:
               diff = svn.fs.FileDiff(self.repos.get_root(change.base_rev),
-                                     base_path,
+                                     base_path_bytes,
                                      self.repos.root_this, change.path,
                                      self.pool)
-              label1 = '%s\t%s\t(r%s, copy source)' \
-                       % (base_path, base_date, change.base_rev)
-              label2 = '%s\t%s\t(r%s)' \
-                       % (change.path, self.date, self.repos.rev)
+              label1 = ('%s\t%s\t(r%s, copy source)'
+                        % (base_path, base_date, change.base_rev))
+              label2 = ('%s\t%s\t(r%s)'
+                        % (to_str(change.path), self.date, self.repos.rev))
               singular = False
           else:
             # this file was copied.
@@ -912,11 +955,12 @@ class DiffGenerator:
             if self.diffsels.copy:
               diff = svn.fs.FileDiff(None, None, self.repos.root_this,
                                      change.path, self.pool)
-              label1 = '/dev/null\t00:00:00 1970\t' \
-                       '(empty, because file is newly added)'
-              label2 = '%s\t%s\t(r%s, copy of r%s, %s)' \
-                       % (change.path, self.date, self.repos.rev, \
-                          change.base_rev, base_path)
+              label1 = ('/dev/null\t00:00:00 1970\t'
+                        '(empty, because file is newly added)')
+              label2 = ('%s\t%s\t(r%s, copy of r%s, %s)'
+                        % (to_str(change.path),
+                           self.date, self.repos.rev, change.base_rev,
+                           base_path))
               singular = False
         else:
           # the file was added.
@@ -932,7 +976,7 @@ class DiffGenerator:
             label1 = '/dev/null\t00:00:00 1970\t' \
                      '(empty, because file is newly added)'
             label2 = '%s\t%s\t(r%s)' \
-                     % (change.path, self.date, self.repos.rev)
+                     % (to_str(change.path), self.date, self.repos.rev)
             singular = True
 
       elif not change.text_changed:
@@ -954,7 +998,7 @@ class DiffGenerator:
           label1 = '%s\t%s\t(r%s)' \
                    % (base_path, base_date, change.base_rev)
           label2 = '%s\t%s\t(r%s)' \
-                   % (change.path, self.date, self.repos.rev)
+                   % (to_str(change.path), self.date, self.repos.rev)
           singular = False
 
       if diff:
@@ -977,7 +1021,7 @@ class DiffGenerator:
       # return a data item for this diff
       return _data(
         path=change.path,
-        base_path=base_path,
+        base_path=base_path_bytes,
         base_rev=change.base_rev,
         diff=diff,
         diff_url=diff_url,
@@ -1144,7 +1188,7 @@ class TextCommitRenderer:
           props = '   (props changed)'
       else:
         props = ''
-      w('   %s%s%s\n' % (d.path, is_dir, props))
+      w('   %s%s%s\n' % (to_str(d.path), is_dir, props))
       if d.copied:
         if is_dir:
           text = ''
@@ -1153,7 +1197,7 @@ class TextCommitRenderer:
         else:
           text = ' unchanged'
         w('      - copied%s from r%d, %s%s\n'
-          % (text, d.base_rev, d.base_path, is_dir))
+          % (text, d.base_rev, to_str(d.base_path), is_dir))
 
   def _render_diffs(self, diffs, section_header):
     """Render diffs. Write the SECTION_HEADER if there are actually
@@ -1170,18 +1214,20 @@ class TextCommitRenderer:
         w(section_header)
         section_header_printed = True
       if diff.kind == 'D':
-        w('\nDeleted: %s\n' % diff.base_path)
+        w('\nDeleted: %s\n' % to_str(diff.base_path))
       elif diff.kind == 'A':
-        w('\nAdded: %s\n' % diff.path)
+        w('\nAdded: %s\n' % to_str(diff.path))
       elif diff.kind == 'C':
         w('\nCopied: %s (from r%d, %s)\n'
-          % (diff.path, diff.base_rev, diff.base_path))
+          % (to_str(diff.path), diff.base_rev,
+             to_str(diff.base_path)))
       elif diff.kind == 'W':
         w('\nCopied and modified: %s (from r%d, %s)\n'
-          % (diff.path, diff.base_rev, diff.base_path))
+          % (to_str(diff.path), diff.base_rev,
+             to_str(diff.base_path)))
       else:
         # kind == 'M'
-        w('\nModified: %s\n' % diff.path)
+        w('\nModified: %s\n' % to_str(diff.path))
 
       if diff.diff_url:
         w('URL: %s\n' % diff.diff_url)
@@ -1198,8 +1244,9 @@ class TextCommitRenderer:
           w('Binary file (source and/or target). No diff available.\n')
         continue
 
+      wb = self.output.write_binary
       for line in diff.content:
-        w(line.raw)
+        wb(line.raw)
 
 
 class Repository:
@@ -1218,6 +1265,8 @@ class Repository:
     self.root_this = self.get_root(rev)
 
     self.author = self.get_rev_prop(svn.core.SVN_PROP_REVISION_AUTHOR)
+    if self.author is not None:
+      self.author = to_str(self.author)
 
   def get_rev_prop(self, propname, rev = None):
     if not rev:
@@ -1426,9 +1475,9 @@ class Config:
     "Return the path's associated groups."
     groups = []
     for group, pattern, exclude_pattern, repos_params, search_logmsg_re in self._group_re:
-      match = pattern.match(path)
+      match = pattern.match(to_str(path))
       if match:
-        if exclude_pattern and exclude_pattern.match(path):
+        if exclude_pattern and exclude_pattern.match(to_str(path)):
           continue
         params = repos_params.copy()
         params.update(match.groupdict())
@@ -1507,7 +1556,7 @@ if the property was added, modified or d
     usage()
 
   cmd = sys.argv[1]
-  repos_dir = svn.core.svn_path_canonicalize(sys.argv[2])
+  repos_dir = to_str(svn.core.svn_path_canonicalize(to_bytes(sys.argv[2])))
   try:
     expected_args = cmd_list[cmd]
   except KeyError:

Modified: subversion/branches/1.14.x/tools/hook-scripts/mailer/tests/mailer-t1.output
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/tools/hook-scripts/mailer/tests/mailer-t1.output?rev=1885829&r1=1885828&r2=1885829&view=diff
==============================================================================
--- subversion/branches/1.14.x/tools/hook-scripts/mailer/tests/mailer-t1.output (original)
+++ subversion/branches/1.14.x/tools/hook-scripts/mailer/tests/mailer-t1.output Sat Jan 23 04:00:51 2021
@@ -1,4 +1,4 @@
-Group: file
+Group: All
 Subject: r1 -  dir1 dir2
 
 Author: mailer test
@@ -9,9 +9,43 @@ 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)
@@ -25,7 +59,7 @@ Added: file2
 +++ file2	Sun Sep  9 01:46:40 2001	(r1)
 @@ -0,0 +1 @@
 +file2
-Group: file plus other areas
+Group: file
 Subject: r1 -  dir1 dir2
 
 Author: mailer test
@@ -39,15 +73,6 @@ 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)
@@ -61,37 +86,7 @@ Added: file2
 +++ 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
+Group: file plus other areas
 Subject: r1 -  dir1 dir2
 
 Author: mailer test
@@ -102,14 +97,33 @@ 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
-   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
+
+Diffs of changes in other areas also in this revision:
 
 Added: dir1/file3
 ==============================================================================
@@ -138,21 +152,7 @@ Added: dir2/file6
 +++ 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
+Group: All
 Subject: r2 -  dir1 dir2
 
 Author: mailer test
@@ -163,9 +163,19 @@ 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)
@@ -204,7 +214,7 @@ Modified: file2
 @@ -1 +1,2 @@
  file2
 +change C1
-Group: All
+Group: file
 Subject: r2 -  dir1 dir2
 
 Author: mailer test
@@ -215,19 +225,9 @@ 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)
@@ -286,6 +286,11 @@ Added:
       - copied unchanged from r2, file1
    dir3/   (props changed)
       - copied from r2, dir1/
+Replaced:
+   dir3/file3
+      - copied unchanged from r1, dir1/file3
+   dir3/file4
+      - copied unchanged from r1, dir1/file4
 
 Copied: dir2/file7 (from r2, file1)
 ==============================================================================
@@ -293,6 +298,20 @@ Copied: dir2/file7 (from r2, file1)
 +++ dir2/file7	Sun Sep  9 07:20:00 2001	(r3, copy of r2, file1)
 @@ -0,0 +1 @@
 +file1
+
+Copied: dir3/file3 (from r1, dir1/file3)
+==============================================================================
+--- /dev/null	00:00:00 1970	(empty, because file is newly added)
++++ dir3/file3	Sun Sep  9 07:20:00 2001	(r3, copy of r1, dir1/file3)
+@@ -0,0 +1 @@
++file3
+
+Copied: dir3/file4 (from r1, dir1/file4)
+==============================================================================
+--- /dev/null	00:00:00 1970	(empty, because file is newly added)
++++ dir3/file4	Sun Sep  9 07:20:00 2001	(r3, copy of r1, dir1/file4)
+@@ -0,0 +1 @@
++file4
 Group: All
 Subject: r4 - dir3
 
@@ -314,7 +333,7 @@ Copied and modified: dir3/file8 (from r2
 @@ -1 +1,2 @@
  file1
 +change C3
-Group: file
+Group: All
 Subject: r5 -  dir1 dir3
 
 Author: mailer test
@@ -325,8 +344,10 @@ Log:
 changes and deletes of properties
 
 Modified:
+   dir1/   (props changed)
+   dir3/   (props changed)
    file2   (props changed)
-Group: file plus other areas
+Group: file
 Subject: r5 -  dir1 dir3
 
 Author: mailer test
@@ -338,12 +359,7 @@ 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
+Group: file plus other areas
 Subject: r5 -  dir1 dir3
 
 Author: mailer test
@@ -354,10 +370,13 @@ 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)
-   file2   (props changed)
-Group: file
+Group: All
 Subject: r6 -  dir1 dir4
 
 Author: mailer test
@@ -368,7 +387,18 @@ 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
 ==============================================================================
@@ -376,8 +406,8 @@ Added: file9
 +++ file9	Sun Sep  9 15:40:00 2001	(r6)
 @@ -0,0 +1 @@
 +file9
-Group: file plus other areas
-Subject: r6 -  dir1 dir4
+Group: bugtracker
+Subject: Fix for Blah#987: r6 -  dir1 dir4
 
 Author: mailer test
 Date: Sun Sep  9 15:40:00 2001
@@ -387,23 +417,11 @@ Log:
 mixed addition and change.  Fixes Blaz#456 Blah#987
 
 Added:
-   file9
-
-Changes in other areas also in this revision:
-Added:
    dir4/
+   file9
 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)
@@ -411,6 +429,13 @@ Modified: dir1/file3
 @@ -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 Blaz#456: r6 -  dir1 dir4
 
@@ -441,8 +466,8 @@ Added: file9
 +++ file9	Sun Sep  9 15:40:00 2001	(r6)
 @@ -0,0 +1 @@
 +file9
-Group: bugtracker
-Subject: Fix for Blah#987: r6 -  dir1 dir4
+Group: file
+Subject: r6 -  dir1 dir4
 
 Author: mailer test
 Date: Sun Sep  9 15:40:00 2001
@@ -452,18 +477,7 @@ 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
 ==============================================================================
@@ -471,7 +485,7 @@ Added: file9
 +++ file9	Sun Sep  9 15:40:00 2001	(r6)
 @@ -0,0 +1 @@
 +file9
-Group: All
+Group: file plus other areas
 Subject: r6 -  dir1 dir4
 
 Author: mailer test
@@ -482,11 +496,23 @@ Log:
 mixed addition and change.  Fixes Blaz#456 Blah#987
 
 Added:
-   dir4/
    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)
@@ -494,13 +520,47 @@ Modified: dir1/file3
 @@ -1 +1,2 @@
  file3
 +change C4
+Group: All
+Subject: r7 -  dir1 dir2 dir3 dir3/dir5
 
-Added: file9
+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)
-+++ file9	Sun Sep  9 15:40:00 2001	(r6)
++++ dir1/file10	Sun Sep  9 18:26:40 2001	(r7)
 @@ -0,0 +1 @@
-+file9
++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: file
 Subject: r7 -  dir1 dir2 dir3 dir3/dir5
 
@@ -568,47 +628,6 @@ Modified: dir3/file3
  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
@@ -644,7 +663,7 @@ Modified: dir6/file4
 @@ -1 +1,2 @@
  file4
 +change C6
-Group: file
+Group: All
 Subject: r9 - 
 
 Author: mailer test
@@ -662,7 +681,7 @@ Modified:
 Added: file11
 ==============================================================================
 Binary file. No diff available.
-Group: file plus other areas
+Group: file
 Subject: r9 - 
 
 Author: mailer test
@@ -680,7 +699,7 @@ Modified:
 Added: file11
 ==============================================================================
 Binary file. No diff available.
-Group: All
+Group: file plus other areas
 Subject: r9 - 
 
 Author: mailer test
@@ -698,7 +717,7 @@ Modified:
 Added: file11
 ==============================================================================
 Binary file. No diff available.
-Group: file
+Group: All
 Subject: r10 - 
 
 Author: mailer test
@@ -715,7 +734,7 @@ Modified:
 Modified: file11
 ==============================================================================
 Binary file (source and/or target). No diff available.
-Group: file plus other areas
+Group: file
 Subject: r10 - 
 
 Author: mailer test
@@ -732,7 +751,7 @@ Modified:
 Modified: file11
 ==============================================================================
 Binary file (source and/or target). No diff available.
-Group: All
+Group: file plus other areas
 Subject: r10 - 
 
 Author: mailer test

Modified: subversion/branches/1.14.x/tools/hook-scripts/mailer/tests/mailer-tweak.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.14.x/tools/hook-scripts/mailer/tests/mailer-tweak.py?rev=1885829&r1=1885828&r2=1885829&view=diff
==============================================================================
--- subversion/branches/1.14.x/tools/hook-scripts/mailer/tests/mailer-tweak.py (original)
+++ subversion/branches/1.14.x/tools/hook-scripts/mailer/tests/mailer-tweak.py Sat Jan 23 04:00:51 2021
@@ -50,10 +50,10 @@ def tweak_dates(pool, home='.'):
 
   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)
+    date = core.svn_time_to_cstring((DATE_BASE+i*DATE_INCR) * 1000000, 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)
+    fs.change_rev_prop(fsob, i+1, core.SVN_PROP_REVISION_AUTHOR, b'mailer test', pool)
 
 def main():
   if len(sys.argv) != 2: