@@ -189,10 +189,8 @@ def is_release_branch(self, branch_name: Optional[str]) -> bool:
189189 True if the branch is used for `release` code; False otherwise
190190 """
191191 branch_pattern = configuration .get_value (ConfigurationVariable .RELEASE_BRANCH_PATTERN )
192- if not branch_pattern or not branch_name :
193- return False
194- is_release : Optional [Any ] = re .search (branch_pattern , str (branch_name ))
195- return True if is_release else False
192+ is_release , _ = self ._is_branch_of_type (branch_name , branch_pattern )
193+ return is_release
196194
197195 def fetch (self ) -> None :
198196 """Fetches latest changes."""
@@ -529,11 +527,23 @@ def _get_remote(self) -> Optional[Any]:
529527
530528 def list_files_added_on_current_branch (self ) -> List [str ]:
531529 """Returns a list of files changed against master branch."""
532- master_branch_commit = self .repo .commit (self .get_master_branch ())
530+ master_branch = self .get_master_branch ()
531+ beta_branch = self .get_beta_branch ()
532+ master_branch_commit = self .repo .commit (master_branch )
533+ beta_branch_commit = self .repo .commit (beta_branch )
533534 current_branch_commit = self .repo .commit (self .get_current_branch ())
534- changes = self .get_changes_list (
535- self .get_branch_point (master_branch_commit , current_branch_commit ), current_branch_commit , change_type = "a"
536- )
535+ # Finding the baseline branch to consider
536+ master_branch_point = self .repo .commit (self .get_branch_point (master_branch_commit , current_branch_commit ))
537+ beta_branch_point = self .repo .commit (self .get_branch_point (beta_branch_commit , current_branch_commit ))
538+ branch_point = master_branch_point
539+ if not master_branch :
540+ branch_point = beta_branch_point
541+ elif beta_branch and master_branch :
542+ if beta_branch_point .committed_datetime > master_branch_point .committed_datetime :
543+ # The branch point off `beta` is more recent than off `master`.
544+ # Hence, the difference between current and `beta` should be considered.
545+ branch_point = beta_branch_point
546+ changes = self .get_changes_list (branch_point , current_branch_commit , change_type = "a" )
537547 return changes
538548
539549 def is_current_branch_feature (self ) -> bool :
@@ -544,6 +554,18 @@ def is_current_branch_feature(self) -> bool:
544554 is_release = self .is_release_branch (current_branch )
545555 return not (is_master or is_beta or is_release )
546556
557+ def is_current_branch_of_type (self , pattern : str ) -> (bool , Optional [List [Any ]]):
558+ """Returns boolean indicating whether the current branch follows the pattern and the list of groups if any."""
559+ return self ._is_branch_of_type (self .get_current_branch (), pattern )
560+
561+ def _is_branch_of_type (self , branch_name : Optional [str ], pattern : Optional [str ]) -> (bool , Optional [List [Any ]]):
562+ if not pattern :
563+ return False , None
564+ if not branch_name :
565+ return False , None
566+ match = re .search (pattern , str (branch_name ))
567+ return True if match else False , match .groups () if match else None
568+
547569 @property
548570 def uncommitted_changes (self ) -> List [Path ]:
549571 """Gets list of uncommitted files.
0 commit comments