fix git_get_remote
This commit is contained in:
parent
fc86622c1f
commit
a367a73a65
1 changed files with 2 additions and 3 deletions
|
@ -1,4 +1,3 @@
|
||||||
import subprocess
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
import lightbulb
|
import lightbulb
|
||||||
|
@ -25,7 +24,8 @@ async def get_git_branch():
|
||||||
return await create_subprocess("git", "rev-parse", "--abbrev-ref", "HEAD")
|
return await create_subprocess("git", "rev-parse", "--abbrev-ref", "HEAD")
|
||||||
|
|
||||||
async def get_git_remote():
|
async def get_git_remote():
|
||||||
return await create_subprocess("git", "branch", "-r")
|
remote = await create_subprocess("git", "branch", "-vv")
|
||||||
|
return remote.split("[")[1].split("]")[0]
|
||||||
|
|
||||||
async def get_git_head_diff_branch(branch: str) -> str:
|
async def get_git_head_diff_branch(branch: str) -> str:
|
||||||
# diff HEAD to remote
|
# diff HEAD to remote
|
||||||
|
@ -38,7 +38,6 @@ async def get_git_index_diff_branch(branch: str) -> str:
|
||||||
async def get_git_commits_ahead_behind(branch: str, remote: str) -> tuple[int, int]:
|
async def get_git_commits_ahead_behind(branch: str, remote: str) -> tuple[int, int]:
|
||||||
# commits ahead/behind remote
|
# commits ahead/behind remote
|
||||||
output = await create_subprocess("git", "rev-list", "--left-right", "--count", branch+"..."+remote)
|
output = await create_subprocess("git", "rev-list", "--left-right", "--count", branch+"..."+remote)
|
||||||
print("git_commmits_ahead:", output)
|
|
||||||
commits_ahead = int(output.split()[0])
|
commits_ahead = int(output.split()[0])
|
||||||
commits_behind = int(output.split()[1])
|
commits_behind = int(output.split()[1])
|
||||||
return commits_ahead, commits_behind
|
return commits_ahead, commits_behind
|
||||||
|
|
Loading…
Reference in a new issue