turbaszek commented on a change in pull request #13767:
URL: https://github.com/apache/airflow/pull/13767#discussion_r567933609



##########
File path: dev/provider_packages/prepare_provider_packages.py
##########
@@ -1225,184 +1269,308 @@ def 
get_provider_info_from_provider_yaml(provider_package_id: str) -> Dict[str,
     return provider_info
 
 
-def update_generated_files_for_package(
+def get_backport_current_changes_table(previous_release_commit_ref: str, 
source_provider_package_path: str):
+    git_cmd = get_git_log_command(HEAD_OF_HTTPS_REMOTE, 
previous_release_commit_ref)
+    try:
+        changes = subprocess.check_output(git_cmd, 
cwd=source_provider_package_path, universal_newlines=True)
+        changes_table = convert_git_changes_to_table(
+            previous_release_commit_ref, changes, 
base_url="https://github.com/apache/airflow/commit/";
+        )
+    except subprocess.CalledProcessError:
+        changes_table = ''
+    return changes_table
+
+
+def get_version_tag(version: str, provider_package_id: str, version_suffix: 
str = ''):
+    return 
f"providers-{provider_package_id.replace('.','-')}/{version}{version_suffix}"
+
+
+def print_changes_table(changes_table):
+    syntax = Syntax(changes_table, "rst", theme="ansi_dark")
+    console = Console(width=200)
+    console.print(syntax)
+
+
+def get_all_changes_for_regular_packages(
+    versions: List[str],
     provider_package_id: str,
-    current_release_version: str,
+    source_provider_package_path: str,
     version_suffix: str,
-    imported_classes: List[str],
-    backport_packages: bool,
-    update_release_notes: bool,
-    update_setup: bool,
-) -> Tuple[int, int]:
-    """
-    Updates release notes (BACKPORT_PROVIDER_README.md/README.md) for the 
package.
-    Returns Tuple of total number of entities and badly named entities.
+) -> Tuple[bool, str]:
+    current_version = versions[0]
+    current_tag_no_suffix = get_version_tag(current_version, 
provider_package_id)
+    print(f"Checking if tag '{current_tag_no_suffix}' exist.")
+    if not subprocess.call(
+        get_git_tag_check_command(current_tag_no_suffix),
+        cwd=source_provider_package_path,
+        stderr=subprocess.DEVNULL,
+    ):
+        print(f"The tag {current_tag_no_suffix} exists.")
+        # The tag already exists
+        changes = subprocess.check_output(
+            get_git_log_command(HEAD_OF_HTTPS_REMOTE, current_tag_no_suffix),
+            cwd=source_provider_package_path,
+            universal_newlines=True,
+        )
+        if len(changes) > 0:

Review comment:
       Comparing `len` to 0 is not pylint friendly :) 




----------------------------------------------------------------
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:
[email protected]


Reply via email to