def calculate_base_branch(version, path):
 if (not (is_release(version) or is_weekly_release(version) or is_pre_release(version))):
  raise NotARelease()
 repo = Repo(path=path, search_parent_directories=True)
 existing_tags = [tag for tag in repo.tags if (tag.name == version)]
 if existing_tags:
  raise TagExists()
 base_branch_name = 'master'
 repo.git.checkout(base_branch_name)
 return (branch for branch in repo.branches if (branch.name == base_branch_name)).next()

def calculate_base_branch ( version , path ) : if ( not ( is_release ( version ) or is_weekly_release ( version ) or is_pre_release ( version ) ) ) : raise NotARelease ( ) repo = Repo ( path = path , search_parent_directories = True ) existing_tags = [ tag for tag in repo . tags if ( tag . name == version ) ] if existing_tags : raise TagExists ( ) base_branch_name = 'master' repo . git . checkout ( base_branch_name ) return ( branch for branch in repo . branches if ( branch . name == base_branch_name ) ) . next ( )
the branch a release branch is created from depends on the release type and sometimes which pre-releases have preceeded this .