changeset b01c456ba67a in tryton-tools:default
details: https://hg.tryton.org/tryton-tools?cmd=changeset;node=b01c456ba67a
description:
        Make to_release compatible Python  2 and 3
diffstat:

 to_release |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (61 lines):

diff -r ec44df2b04a9 -r b01c456ba67a to_release
--- a/to_release        Mon Mar 25 09:52:45 2019 +0100
+++ b/to_release        Mon Apr 01 09:48:58 2019 +0200
@@ -11,15 +11,16 @@
     return (os.path.isdir(directory)
         and os.path.isdir(os.path.join(directory, '.hg')))
 
+
 exit_code = 0
 directories = sys.argv[1:] or ['.']
 for directory in directories:
     if not is_repository(directory):
         continue
     current_branch = subprocess.check_output('hg id -b --cwd "%s"' % directory,
-        shell=True).strip()
+        shell=True, universal_newlines=True).strip()
     branches = subprocess.check_output('hg branches --cwd "%s"' % directory,
-        shell=True)
+        shell=True, universal_newlines=True)
     branches = [(b.split()[0], b.split()[1].split(':')[0])
         for b in branches.splitlines()]
     for branch, tip in branches:
@@ -29,7 +30,7 @@
             if current_branch != branch:
                 continue
         tags = subprocess.check_output('hg tags --cwd "%s"|grep "^%s"'
-            % (directory, branch), shell=True)
+            % (directory, branch), shell=True, universal_newlines=True)
         tag = tags.splitlines()[0].split()[0]
         changes = subprocess.check_output(
             'hg log -b "%(branch)s" --cwd "%(directory)s" '
@@ -38,7 +39,7 @@
                 'directory': directory,
                 'tip': tip,
                 'tag': tag,
-                }, shell=True)
+                }, shell=True, universal_newlines=True)
         changes = int(changes.strip())
         if int(tag.split('.')[-1]) == 0:
             # First release tag is not in the branch
@@ -48,14 +49,14 @@
             # For earlier branches, the last tag could not be in the branch
             commits = subprocess.check_output(
                     'hg log -b "%s" --cwd "%s"|grep "changeset: "|wc -l'
-                    % (branch, directory), shell=True)
+                    % (branch, directory), shell=True, universal_newlines=True)
             commits = int(commits.strip())
         if changes > 3 or (2 <= commits <= 3):
             if sys.argv[1:]:
-                print "%(directory)s %(branch)s: %(changes)d changes" % {
-                    'directory': directory,
-                    'branch': branch,
-                    'changes': changes,
-                    }
+                print("%(directory)s %(branch)s: %(changes)d changes" % {
+                        'directory': directory,
+                        'branch': branch,
+                        'changes': changes,
+                        })
             exit_code += 1
 exit(exit_code)

Reply via email to