Ejemplo n.º 1
0
 def extract_version_tag_from_git():
     from gitpy import LocalRepository
     from os import curdir, path
     repository = LocalRepository(curdir)
     branch = repository.getCurrentBranch()
     head = repository.getHead()
     if branch is None:
         return get_commit_describe(head)
     current_branch = branch.name
     stripped_branch = current_branch.split('/')[0]
     if stripped_branch in ('release', 'support', 'hotfix'):
         return get_commit_describe(head)
     if 'master' in stripped_branch:
         return get_commit_describe(head)
     else:
         try:
             return get_commit_describe(head, 'v*')
         except:
             pass
         return get_commit_describe(head)
     pass
Ejemplo n.º 2
0
def assert_on_branch(branch_name):
    repository = LocalRepository(curdir)
    current_branch = repository.getCurrentBranch()
    if current_branch is None or current_branch.name != branch_name:
        logger.error("not currently on branch {}".format(branch_name))
        raise SystemExit(1)
def assert_on_branch(branch_name):
    repository = LocalRepository(curdir)
    current_branch = repository.getCurrentBranch()
    if current_branch is None or current_branch.name != branch_name:
        logger.error("not currently on branch {}".format(branch_name))
        raise AssertionError()