mirror of
https://github.com/powerline/powerline.git
synced 2025-07-27 07:44:36 +02:00
implement stash backend for git
This commit is contained in:
parent
802791e979
commit
4d62732ed5
@ -102,6 +102,13 @@ try:
|
|||||||
def ignore_event(path, name):
|
def ignore_event(path, name):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def stash(self):
|
||||||
|
try:
|
||||||
|
stashref = git.Repository(git_directory(self.directory)).lookup_reference('refs/stash')
|
||||||
|
except KeyError:
|
||||||
|
return 0
|
||||||
|
return sum(1 for _ in stashref.log())
|
||||||
|
|
||||||
def do_status(self, directory, path):
|
def do_status(self, directory, path):
|
||||||
if path:
|
if path:
|
||||||
try:
|
try:
|
||||||
@ -171,6 +178,9 @@ except ImportError:
|
|||||||
def _gitcmd(self, directory, *args):
|
def _gitcmd(self, directory, *args):
|
||||||
return readlines(('git',) + args, directory)
|
return readlines(('git',) + args, directory)
|
||||||
|
|
||||||
|
def stash(self):
|
||||||
|
return sum(1 for _ in self._gitcmd(self.directory, 'stash', 'list'))
|
||||||
|
|
||||||
def do_status(self, directory, path):
|
def do_status(self, directory, path):
|
||||||
if path:
|
if path:
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user