lafiona commented on code in PR #14533:
URL: https://github.com/apache/arrow/pull/14533#discussion_r1066400790
##########
dev/merge_arrow_pr.py:
##########
@@ -110,10 +111,33 @@ def strip_ci_directives(commit_message):
return _REGEX_CI_DIRECTIVE.sub('', commit_message)
+def git_default_branch_name():
+ default_branch_name = os.getenv("MERGE_SCRIPT_DEFAULT_BRANCH_NAME")
+
+ if default_branch_name is None:
+ try:
+ default_reference = run_cmd(
+ "git rev-parse --abbrev-ref origin/HEAD")
+ default_branch_name = default_reference.lstrip("origin/")
+ default_branch_name = default_branch_name.rstrip()
+ except subprocess.CalledProcessError:
+ # TODO: ARROW-18011 to track changing the hard coded default
+ # value from "master" to "main".
+ default_branch_name = "master"
+ warnings.warn('Unable to determine default branch name: '
+ 'MERGE_SCRIPT_DEFAULT_BRANCH_NAME environment '
+ 'variable is not set. Git repository does not '
+ 'contain a \'refs/remotes/origin/HEAD\'reference. '
+ ' Setting the default branch name to ' +
+ default_branch_name, RuntimeWarning)
+
+ return default_branch_name
+
+
def fix_version_from_branch(branch, versions):
# Note: Assumes this is a sorted (newest->oldest) list of un-released
# versions
- if branch == "master":
+ if branch == git_default_branch_name():
return versions[-1]
else:
Review Comment:
@raulcd , thanks for this suggestion and confirmation that it's leftover
code. I'll remove the conditional here as you suggested.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]