You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/25 15:06:45 UTC

[GitHub] [arrow] raulcd commented on a diff in pull request #13230: ARROW-16654: [Dev][Archery] Support cherry-picking for major releases

raulcd commented on code in PR #13230:
URL: https://github.com/apache/arrow/pull/13230#discussion_r881762224


##########
dev/archery/archery/release.py:
##########
@@ -287,44 +296,42 @@ def from_jira(version, jira=None, repo=None):
         elif not isinstance(version, Version):
             raise TypeError(version)
 
-        # decide the type of the release based on the version number
-        if version.patch == 0:
-            if version.minor == 0:
-                klass = MajorRelease
-            elif version.major == 0:
-                # handle minor releases before 1.0 as major releases
-                klass = MajorRelease
-            else:
-                klass = MinorRelease
-        else:
-            klass = PatchRelease
+        self.version = version
+        self.jira = jira
+        self.repo = repo
 
-        # prevent instantiating release object directly
-        obj = klass.__new__(klass)
-        obj.version = version
-        obj.jira = jira
-        obj.repo = repo
+    def __repr__(self):
+        if self.version.released:
+            status = "released_at={self.version.release_date!r}"
+        else:
+            status = "pending"
+        return f"<{self.__class__.__name__} {self.version!r} {status}>"
 
-        return obj
+    @staticmethod
+    def from_jira(version, jira=None, repo=None):
+        return Release(version, jira, repo)
 
     @property
     def is_released(self):
         return self.version.released
 
     @property
     def tag(self):
-        return "apache-arrow-{}".format(str(self.version))
+        return f"apache-arrow-{self.version}"
 
-    @property
+    @abstractproperty

Review Comment:
   this seems to be deprecated https://docs.python.org/3/library/abc.html#abc.abstractproperty in favor of:
   
   ```
   @property
   @abstractmethod
   ```
   should we use that instead?



##########
dev/archery/archery/release.py:
##########
@@ -370,11 +377,10 @@ def commits(self):
             try:
                 upper = self.repo.branches[self.branch]
             except IndexError:
-                warnings.warn("Release branch `{}` doesn't exist."
-                              .format(self.branch))
+                warnings.warn(f"Release branch `{self.branch}` doesn't exist.")
                 return []
 
-        commit_range = "{}..{}".format(lower, upper)
+        commit_range = f"{lower}..{upper}"

Review Comment:
   I love the f-string changes. Thanks!



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org