airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] XD-DENG commented on a change in pull request #6772: [AIRFLOW-XXX] Update airflow-jira release management script
Date Wed, 11 Dec 2019 02:04:55 GMT
XD-DENG commented on a change in pull request #6772: [AIRFLOW-XXX] Update airflow-jira release
management script
URL: https://github.com/apache/airflow/pull/6772#discussion_r356371739
 
 

 ##########
 File path: dev/airflow-jira
 ##########
 @@ -195,19 +201,124 @@ def compare(target_version, previous_version=None, unmerged_only=False):
         else:
             status = status[:10].ljust(10)
 
-        merge = merges.get(issue.key)
-        if not merge and issue.fields.status.name in {'Resolved', 'Closed'}:
-            merge = get_commits_from_master(repo, issue)
-
-        print(formatstr.format(
-            id=issue.key,
-            typ=issue.fields.issuetype,
-            priority=issue.fields.priority,
-            status=status,
-            description=issue.fields.summary,
-            merged=is_merged,
-            pr=merge['pull_request'] if merge else "-",
-            commit=merge['id'] if merge else "-"))
+        # Find the merges in master targeting this issue
+        master_merges = get_commits_from_master(repo, issue)
+
+        on_branch = {
+            m['pull_request']: m
+            for m in branch_merges.get(issue.key, [])
+        }
+
+        def print_merge_info(merge, printed_desc):
+            nonlocal num_merged
+
+            is_merged = merge['merged']
+
+            if is_merged:
+                num_merged += 1
+                if unmerged_only:
+                    return False
+            else:
+                num_unmerged[issue.fields.status.name] += 1
+
+            if not printed_desc:
+                # Only print info on first line for each issue
+                fields = dict(
+                    id=issue.key,
+                    typ=issue.fields.issuetype,
+                    priority=issue.fields.priority,
+                    status=status,
+                    description=issue.fields.summary,
+                )
+            else:
+                fields = dict(
+                    id=issue.key,
+                    typ="",
+                    priority="",
+                    status=" " * 10,
+                    description="",
+                )
+            print(formatstr.format(
+                **fields,
+                merged=is_merged,
+                pr=merge['pull_request'],
+                commit=merge['id']))
+            return True
+
+        printed_desc = False
+        for merge in master_merges:
+            if merge['pull_request'] in on_branch:
+                merge = on_branch[merge['pull_request']]
+
+            printed_desc = print_merge_info(merge, printed_desc)
+
+        if not master_merges:
+            if on_branch:
+                for merge in branch_merges.get(issue.key):
+                    printed_desc = print_merge_info(merge, printed_desc)
+            else:
+                # No merges, issue likely still open
+                print_merge_info({
+                    'merged': 0,
+                    'pull_request': '-',
+                    'id': '-',
+                }, printed_desc)
+
+    print("Commits on branch: {0:d}, {1:d} ({2}) yet to be cherry-picked".format(num_merged,
sum(num_unmerged.values()), dict(num_unmerged)))
+
+
+@cli.command(short_help='Build a CHANGELOG grouped by Jira Issue type')
+@click.argument('previous_version')
+@click.argument('target_version')
+def changelog(previous_version, target_version):
+    repo = git.Repo(".", search_parent_directories=True)
+    # Get  a list of issues/PRs that have been commited on the current branch.
 
 Review comment:
   Duplicated spaces here again.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message