Author: svn-role
Date: Sat Nov 14 04:00:12 2020
New Revision: 1883406

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

 * r1878855, r1878859
   Make the hot-backup.py script work with Python 3.
   Justification:
     Script should work with Python3
   Votes:
     +1: jamessan, brane

Modified:
    subversion/branches/1.14.x/   (props changed)
    subversion/branches/1.14.x/STATUS
    subversion/branches/1.14.x/tools/backup/hot-backup.py.in

Propchange: subversion/branches/1.14.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1878855,1878859

Modified: subversion/branches/1.14.x/STATUS
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.14.x/STATUS?rev=1883406&r1=1883405&r2=1883406&view=diff
==============================================================================
--- subversion/branches/1.14.x/STATUS (original)
+++ subversion/branches/1.14.x/STATUS Sat Nov 14 04:00:12 2020
@@ -111,13 +111,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1878855, r1878859
-   Make the hot-backup.py script work with Python 3.
-   Justification:
-     Script should work with Python3
-   Votes:
-     +1: jamessan, brane
-
  * r1882115
    JavaHL: Fix incorrect cache in SVNBase::createCppBoundObject
    Justification:

Modified: subversion/branches/1.14.x/tools/backup/hot-backup.py.in
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.14.x/tools/backup/hot-backup.py.in?rev=1883406&r1=1883405&r2=1883406&view=diff
==============================================================================
--- subversion/branches/1.14.x/tools/backup/hot-backup.py.in (original)
+++ subversion/branches/1.14.x/tools/backup/hot-backup.py.in Sat Nov 14 
04:00:12 2020
@@ -36,6 +36,7 @@
 ######################################################################
 
 import sys, os, getopt, stat, re, time, shutil, subprocess
+import functools
 
 ######################################################################
 # Global Settings
@@ -193,7 +194,7 @@ def comparator(a, b):
     if not inca:
       return -1
     elif not incb:
-      return 1;
+      return 1
     elif (int(inca) < int(incb)):
       return -1
     else:
@@ -219,7 +220,7 @@ def get_youngest_revision():
     raise Exception("Unable to find the youngest revision for repository '%s'"
                     ": %s" % (repo_dir, stderr_lines[0].rstrip()))
 
-  return stdout_lines[0].strip()
+  return stdout_lines[0].strip().decode()
 
 ######################################################################
 # Main
@@ -255,7 +256,7 @@ regexp = re.compile("^" + re.escape(repo
 directory_list = os.listdir(backup_dir)
 young_list = [x for x in directory_list if regexp.search(x)]
 if young_list:
-  young_list.sort(comparator)
+  young_list.sort(key = functools.cmp_to_key(comparator))
   increment = regexp.search(young_list.pop()).groupdict()['increment']
   if increment:
     backup_subdir = os.path.join(backup_dir, repo + "-" + youngest + "-"
@@ -348,7 +349,7 @@ if num_backups > 0:
   regexp = re.compile("^" + re.escape(repo) + "-[0-9]+(-[0-9]+)?" + ext_re + 
"$")
   directory_list = os.listdir(backup_dir)
   old_list = [x for x in directory_list if regexp.search(x)]
-  old_list.sort(comparator)
+  old_list.sort(key = functools.cmp_to_key(comparator))
   del old_list[max(0,len(old_list)-num_backups):]
   for item in old_list:
     old_backup_item = os.path.join(backup_dir, item)


Reply via email to