[yt-svn] commit/yt: 2 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Feb 17 13:21:12 PST 2017


2 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/7d6364194622/
Changeset:   7d6364194622
Branch:      yt
User:        ngoldbaum
Date:        2017-02-03 20:00:55+00:00
Summary:     Make the PR backport script function under python3
Affected #:  1 file

diff -r 13c1ee22f924f988c6dfc68c9b64d6e9acdebfd2 -r 7d6364194622219017bc5781436b1bf1f2989276 scripts/pr_backport.py
--- a/scripts/pr_backport.py
+++ b/scripts/pr_backport.py
@@ -40,19 +40,19 @@
     """
     with hglib.open(repo_path) as client:
         tags = client.log("reverse(tag())")
-        tags = sorted([LooseVersion(t[2]) for t in tags])
+        tags = [t[2].decode('utf8') for t in tags]
+        tags = sorted([t for t in tags if t[:2] == 'yt'])
         for t in tags[::-1]:
-            if t.version[0:2] != ['yt', '-']:
-                continue
-            if len(t.version) == 4 or t.version[4] == 0:
+            ver = LooseVersion(t)
+            if len(ver.version) == 4 or ver.version[4] == 0:
                 last_major_tag = t
                 break
         last_before_release = client.log(
             "last(ancestors(%s) and branch(yt))" % str(last_major_tag))
+        rev = last_before_release[0][1].decode()
         first_after_release = client.log(
-            "first(descendants(%s) and branch(yt) and not %s)"
-            % (last_before_release[0][1], last_before_release[0][1]))
-    return str(first_after_release[0][1][:12])
+            "first(descendants(%s) and branch(yt) and not %s)" % (rev, rev))
+    return first_after_release[0][1][:12].decode('utf8')
 
 
 def get_branch_tip(repo_path, branch, exclude=None):
@@ -65,7 +65,7 @@
                 revset += "and not %s" % exclude
             except hglib.error.CommandError:
                 pass
-        change = client.log(revset)[0][1][:12]
+        change = client.log(revset)[0][1][:12].decode('utf8')
     return change
 
 
@@ -153,7 +153,7 @@
     """
     for pr in prs[::-1]:
         if pr['merge_commit'] is not None:
-            if pr['merge_commit']['hash'] == needle[1][:12]:
+            if pr['merge_commit']['hash'] == needle[1][:12].decode('utf8'):
                 return pr
     return None
 
@@ -167,8 +167,8 @@
     my_prs = list(prs)
     commit_data = cache_commit_data(my_prs)
     for commit in lineage:
-        cset_hash = commit[1]
-        message = commit[5]
+        cset_hash = commit[1].decode('utf8')
+        message = commit[5].decode('utf8')
         if message.startswith('Merged in') and '(pull request #' in message:
             pr = find_merge_commit_in_prs(commit, my_prs)
             if pr is None:
@@ -186,7 +186,7 @@
 def invert_commits_to_prs_mapping(commits_to_prs):
     """invert the mapping from individual commits to pull requests"""
     inv_map = {}
-    for k, v in commits_to_prs.iteritems():
+    for k, v in commits_to_prs.items():
         # can't save v itself in inv_map since it's an unhashable dictionary
         if v is not None:
             created_date = v['created_on'].split('.')[0]
@@ -210,14 +210,18 @@
 def screen_already_backported(repo_path, inv_map):
     with hglib.open(repo_path) as client:
         tags = client.log("reverse(tag())")
-        major_tags = [t for t in tags if t[2].endswith('.0')]
-        most_recent_major_tag_name = major_tags[0][2]
+        tags = [t[2].decode('utf8') for t in tags]
+        tags = [LooseVersion(t) for t in tags if t.startswith('yt')]
+        major_tags = [
+            t for t in tags if len(t.version) == 4 or t.version[-1] == 0]
+        most_recent_major_tag_name = major_tags[0].vstring
         lineage = client.log(
             "descendants(%s) and branch(stable)" % most_recent_major_tag_name)
         prs_to_screen = []
         for pr in inv_map:
             for commit in lineage:
-                if commit[5].startswith('Backporting PR #%s' % pr[0]):
+                desc = commit[5].decode('utf8')
+                if desc.startswith('Backporting PR #%s' % pr[0]):
                     prs_to_screen.append(pr)
         for pr in prs_to_screen:
             del inv_map[pr]
@@ -227,6 +231,7 @@
     with hglib.open(repo_path) as client:
         commit_info = client.log(commit)[0]
         most_recent_tag_name = client.log("reverse(tag())")[0][2]
+        most_recent_tag_name = most_recent_tag_name.decode('utf8')
         lineage = client.log(
             "descendants(%s) and branch(stable)" % most_recent_tag_name)
         # if there is a stable commit with the same commit message,
@@ -263,7 +268,7 @@
             revset = '"%s"' % revset
             message = "Backporting PR #%s %s" % \
                 (pr['id'], pr['links']['html']['href'])
-            dest = get_last_descendant(repo_path, last_stable)
+            dest = get_last_descendant(repo_path, last_stable).decode('utf8')
             message = \
                 "hg rebase -r %s --keep --collapse -m \"%s\" -d %s\n" % \
                 (revset, message, dest)


https://bitbucket.org/yt_analysis/yt/commits/34b8e48ab378/
Changeset:   34b8e48ab378
Branch:      yt
User:        xarthisius
Date:        2017-02-17 21:21:05+00:00
Summary:     Merged in ngoldbaum/yt (pull request #2515)

Make the PR backport script function under python3

Approved-by: Kacper Kowalik
Approved-by: Matt Turk
Affected #:  1 file

diff -r 490469277e393449dd04255a900f75103d683abe -r 34b8e48ab378959aa6c76c6ee00d77a3b9c1f2b0 scripts/pr_backport.py
--- a/scripts/pr_backport.py
+++ b/scripts/pr_backport.py
@@ -40,19 +40,19 @@
     """
     with hglib.open(repo_path) as client:
         tags = client.log("reverse(tag())")
-        tags = sorted([LooseVersion(t[2]) for t in tags])
+        tags = [t[2].decode('utf8') for t in tags]
+        tags = sorted([t for t in tags if t[:2] == 'yt'])
         for t in tags[::-1]:
-            if t.version[0:2] != ['yt', '-']:
-                continue
-            if len(t.version) == 4 or t.version[4] == 0:
+            ver = LooseVersion(t)
+            if len(ver.version) == 4 or ver.version[4] == 0:
                 last_major_tag = t
                 break
         last_before_release = client.log(
             "last(ancestors(%s) and branch(yt))" % str(last_major_tag))
+        rev = last_before_release[0][1].decode()
         first_after_release = client.log(
-            "first(descendants(%s) and branch(yt) and not %s)"
-            % (last_before_release[0][1], last_before_release[0][1]))
-    return str(first_after_release[0][1][:12])
+            "first(descendants(%s) and branch(yt) and not %s)" % (rev, rev))
+    return first_after_release[0][1][:12].decode('utf8')
 
 
 def get_branch_tip(repo_path, branch, exclude=None):
@@ -65,7 +65,7 @@
                 revset += "and not %s" % exclude
             except hglib.error.CommandError:
                 pass
-        change = client.log(revset)[0][1][:12]
+        change = client.log(revset)[0][1][:12].decode('utf8')
     return change
 
 
@@ -153,7 +153,7 @@
     """
     for pr in prs[::-1]:
         if pr['merge_commit'] is not None:
-            if pr['merge_commit']['hash'] == needle[1][:12]:
+            if pr['merge_commit']['hash'] == needle[1][:12].decode('utf8'):
                 return pr
     return None
 
@@ -167,8 +167,8 @@
     my_prs = list(prs)
     commit_data = cache_commit_data(my_prs)
     for commit in lineage:
-        cset_hash = commit[1]
-        message = commit[5]
+        cset_hash = commit[1].decode('utf8')
+        message = commit[5].decode('utf8')
         if message.startswith('Merged in') and '(pull request #' in message:
             pr = find_merge_commit_in_prs(commit, my_prs)
             if pr is None:
@@ -186,7 +186,7 @@
 def invert_commits_to_prs_mapping(commits_to_prs):
     """invert the mapping from individual commits to pull requests"""
     inv_map = {}
-    for k, v in commits_to_prs.iteritems():
+    for k, v in commits_to_prs.items():
         # can't save v itself in inv_map since it's an unhashable dictionary
         if v is not None:
             created_date = v['created_on'].split('.')[0]
@@ -210,14 +210,18 @@
 def screen_already_backported(repo_path, inv_map):
     with hglib.open(repo_path) as client:
         tags = client.log("reverse(tag())")
-        major_tags = [t for t in tags if t[2].endswith('.0')]
-        most_recent_major_tag_name = major_tags[0][2]
+        tags = [t[2].decode('utf8') for t in tags]
+        tags = [LooseVersion(t) for t in tags if t.startswith('yt')]
+        major_tags = [
+            t for t in tags if len(t.version) == 4 or t.version[-1] == 0]
+        most_recent_major_tag_name = major_tags[0].vstring
         lineage = client.log(
             "descendants(%s) and branch(stable)" % most_recent_major_tag_name)
         prs_to_screen = []
         for pr in inv_map:
             for commit in lineage:
-                if commit[5].startswith('Backporting PR #%s' % pr[0]):
+                desc = commit[5].decode('utf8')
+                if desc.startswith('Backporting PR #%s' % pr[0]):
                     prs_to_screen.append(pr)
         for pr in prs_to_screen:
             del inv_map[pr]
@@ -227,6 +231,7 @@
     with hglib.open(repo_path) as client:
         commit_info = client.log(commit)[0]
         most_recent_tag_name = client.log("reverse(tag())")[0][2]
+        most_recent_tag_name = most_recent_tag_name.decode('utf8')
         lineage = client.log(
             "descendants(%s) and branch(stable)" % most_recent_tag_name)
         # if there is a stable commit with the same commit message,
@@ -263,7 +268,7 @@
             revset = '"%s"' % revset
             message = "Backporting PR #%s %s" % \
                 (pr['id'], pr['links']['html']['href'])
-            dest = get_last_descendant(repo_path, last_stable)
+            dest = get_last_descendant(repo_path, last_stable).decode('utf8')
             message = \
                 "hg rebase -r %s --keep --collapse -m \"%s\" -d %s\n" % \
                 (revset, message, dest)

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list