Skip to content

Commit

Permalink
avoid some name collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
Spitfire1900 committed Mar 28, 2024
1 parent 626b5b2 commit 0899f86
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions xontrib/pygitstatus/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@
@PromptField.wrap(prefix='↑·', info='ahead')
def ahead(fld: PromptField, ctx: PromptFields):
fld.value = ''
ahead, behind = (0, 0)
_ahead, _behind = (0, 0)
with contextlib.suppress(GitError):
repo = Repo('.')

local_commit = repo.head.target
local_branch = repo.branches.get(repo.head.shorthand)
if local_branch is not None and (upstream := local_branch.upstream) is not None:
upstream_commit = upstream.target
ahead, behind = repo.ahead_behind(local_commit, upstream_commit)
_ahead, _behind = repo.ahead_behind(local_commit, upstream_commit)

fld.value = str(ahead) if ahead else ''
fld.value = str(_ahead) if _ahead else ''


@PromptField.wrap(prefix='↓·', info='behind')
def behind(fld: PromptField, ctx: PromptFields):
fld.value = ''
ahead, behind = (0, 0)
_ahead, _behind = (0, 0)
with contextlib.suppress(GitError):
repo = Repo('.')

local_commit = repo.head.target
local_branch = repo.branches.get(repo.head.shorthand)
if local_branch is not None and (upstream := local_branch.upstream) is not None:
upstream_commit = upstream.target
ahead, behind = repo.ahead_behind(local_commit, upstream_commit)
_ahead, _behind = repo.ahead_behind(local_commit, upstream_commit)

fld.value = str(behind) if behind else ''
fld.value = str(_behind) if _behind else ''


def curr_branch() -> Optional[str]:
Expand Down

0 comments on commit 0899f86

Please sign in to comment.