コード例 #1
0
ファイル: gitcmds.py プロジェクト: queer1/git-cola
def current_branch():
    """Return the current branch"""
    decode = core.decode
    head = git.git_path('HEAD')
    try:
        key = os.stat(head).st_mtime
        if _current_branch.key == key:
            return _current_branch.value
    except OSError:
        pass
    status, data = git.rev_parse('HEAD',
                                 symbolic_full_name=True,
                                 with_status=True)
    if status != 0:
        # git init -- read .git/HEAD.  We could do this unconditionally...
        data = _read_git_head(head)

    for refs_prefix in ('refs/heads/', 'refs/remotes/', 'refs/tags/'):
        if data.startswith(refs_prefix):
            value = decode(data[len(refs_prefix):])
            _current_branch.key = key
            _current_branch.value = value
            return value
    # Detached head
    return data
コード例 #2
0
ファイル: gitcmds.py プロジェクト: mwh/git-cola
def current_branch():
    """Return the current branch"""
    decode = core.decode
    head = git.git_path('HEAD')
    try:
        key = os.stat(head).st_mtime
        if _current_branch.key == key:
            return _current_branch.value
    except OSError:
        pass
    data = git.rev_parse('HEAD', with_stderr=True, symbolic_full_name=True)
    if data.startswith('fatal:'):
        # git init -- read .git/HEAD.  We could do this unconditionally
        # and avoid the subprocess call.  It's probably time to start
        # using dulwich.
        data = _read_git_head(head)

    for refs_prefix in ('refs/heads/', 'refs/remotes/'):
        if data.startswith(refs_prefix):
            value = decode(data[len(refs_prefix):])
            _current_branch.key = key
            _current_branch.value = value
            return value
    # Detached head
    return data
コード例 #3
0
ファイル: gitcmds.py プロジェクト: jalaludin/git-cola
def current_branch():
    """Return the current branch"""
    head = git.git_path("HEAD")
    try:
        key = core.stat(head).st_mtime
        if _current_branch.key == key:
            return _current_branch.value
    except OSError:
        pass
    status, data, err = git.rev_parse("HEAD", symbolic_full_name=True)
    if status != 0:
        # git init -- read .git/HEAD.  We could do this unconditionally...
        data = _read_git_head(head)

    for refs_prefix in ("refs/heads/", "refs/remotes/", "refs/tags/"):
        if data.startswith(refs_prefix):
            value = data[len(refs_prefix) :]
            _current_branch.key = key
            _current_branch.value = value
            return value
    # Detached head
    return data
コード例 #4
0
ファイル: gitcmds.py プロジェクト: suside/git-cola
def current_branch():
    """Return the current branch"""
    decode = core.decode
    head = git.git_path('HEAD')
    try:
        key = os.stat(head).st_mtime
        if _current_branch.key == key:
            return _current_branch.value
    except OSError:
        pass
    status, data = git.rev_parse('HEAD', symbolic_full_name=True, with_status=True)
    if status != 0:
        # git init -- read .git/HEAD.  We could do this unconditionally...
        data = _read_git_head(head)

    for refs_prefix in ('refs/heads/', 'refs/remotes/', 'refs/tags/'):
        if data.startswith(refs_prefix):
            value = decode(data[len(refs_prefix):])
            _current_branch.key = key
            _current_branch.value = value
            return value
    # Detached head
    return data
コード例 #5
0
ファイル: main.py プロジェクト: kewelinho/git-cola
 def save_archive(self):
     ref = git.rev_parse('HEAD')[STDOUT]
     shortref = ref[:7]
     GitArchiveDialog.save_hashed_objects(ref, shortref, self)
コード例 #6
0
 def save_archive(self):
     ref = git.rev_parse('HEAD')[STDOUT]
     shortref = ref[:7]
     GitArchiveDialog.save_hashed_objects(ref, shortref, self)
コード例 #7
0
ファイル: view.py プロジェクト: yjpark/git-cola
 def save_archive(self):
     ref = git.rev_parse('HEAD')
     shortref = ref[:7]
     GitArchiveDialog.save(ref, shortref, self)
コード例 #8
0
ファイル: view.py プロジェクト: moreati/git-cola
 def save_archive(self):
     ref = git.rev_parse('HEAD')
     shortref = ref[:7]
     GitArchiveDialog.save(ref, shortref, self)
コード例 #9
0
ファイル: main.py プロジェクト: pwr/git-cola
 def save_archive(self):
     ref = git.rev_parse("HEAD")[STDOUT]
     shortref = ref[:7]
     GitArchiveDialog.save(ref, shortref, self)