Better status reports
parent
6e09f5095e
commit
655dfbb049
|
@ -44,6 +44,7 @@ from ntfs import *
|
||||||
import re
|
import re
|
||||||
import uuid
|
import uuid
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
from kernel import parse_kernel_cmdline
|
||||||
|
|
||||||
class OgProgressPrinter(git.RemoteProgress):
|
class OgProgressPrinter(git.RemoteProgress):
|
||||||
"""
|
"""
|
||||||
|
@ -72,14 +73,49 @@ class OgProgressPrinter(git.RemoteProgress):
|
||||||
|
|
||||||
if sys.stdin.isatty():
|
if sys.stdin.isatty():
|
||||||
self.progress = tqdm()
|
self.progress = tqdm()
|
||||||
|
self.progress.miniters = 1
|
||||||
|
#self.progress.ascii = False
|
||||||
|
|
||||||
def update(self, op_code, cur_count, max_count=None, message=""):
|
def update(self, op_code, cur_count, max_count=None, message=""):
|
||||||
|
op = op_code & git.RemoteProgress.OP_MASK
|
||||||
|
stage = op_code & git.RemoteProgress.STAGE_MASK
|
||||||
|
|
||||||
|
|
||||||
|
op_text = "Unknown"
|
||||||
|
op_unit = "?"
|
||||||
|
|
||||||
|
if op == git.RemoteProgress.COMPRESSING:
|
||||||
|
op_text = "Compressing"
|
||||||
|
op_unit = "Obj"
|
||||||
|
elif op == git.RemoteProgress.CHECKING_OUT:
|
||||||
|
op_text = "Checking out"
|
||||||
|
op_unit = "Obj"
|
||||||
|
elif op == git.RemoteProgress.COUNTING:
|
||||||
|
op_text = "Counting"
|
||||||
|
op_unit = "Obj"
|
||||||
|
elif op == git.RemoteProgress.RECEIVING:
|
||||||
|
op_text = "Receiving"
|
||||||
|
op_unit = "B"
|
||||||
|
elif op == git.RemoteProgress.WRITING:
|
||||||
|
op_text = "Writing"
|
||||||
|
op_unit = "B"
|
||||||
|
elif op == git.RemoteProgress.RESOLVING:
|
||||||
|
op_text = "Resolving deltas"
|
||||||
|
op_unit = "Obj"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.logger.debug(f"Progress: {op_code} {cur_count}/{max_count}: {message}")
|
self.logger.debug(f"Progress: {op_code} {cur_count}/{max_count}: {message}")
|
||||||
|
|
||||||
if self.progress:
|
if max_count is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.progress is None:
|
||||||
self.progress.total = max_count
|
self.progress.total = max_count
|
||||||
self.progress.n = cur_count
|
self.progress.n = cur_count
|
||||||
self.progress.desc = message
|
self.progress.desc = op_text #message
|
||||||
|
self.progress.unit = op_unit
|
||||||
|
self.progress.unit_scale = True
|
||||||
self.progress.refresh()
|
self.progress.refresh()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
@ -217,13 +253,16 @@ class OpengnsysGitLibrary:
|
||||||
'.gitattributes'
|
'.gitattributes'
|
||||||
]
|
]
|
||||||
|
|
||||||
self.kernel_args = self._parse_kernel_cmdline()
|
self.kernel_args = parse_kernel_cmdline()
|
||||||
self.repo_server = self.kernel_args["ogrepo"]
|
self.repo_server = self.kernel_args["ogrepo"]
|
||||||
|
self.ip_address = self.kernel_args["ip"]
|
||||||
|
|
||||||
|
|
||||||
if not self.repo_server:
|
if not self.repo_server:
|
||||||
self.logger.warning("ogrepo kernel argument wasn't passed, or was empty. Defaulting to oglive.")
|
self.logger.warning("ogrepo kernel argument wasn't passed, or was empty. Defaulting to oglive.")
|
||||||
self.repo_server = self.kernel_args["oglive"]
|
self.repo_server = self.kernel_args["oglive"]
|
||||||
|
|
||||||
|
|
||||||
"""Add any untracked files the code might have missed.
|
"""Add any untracked files the code might have missed.
|
||||||
This is a workaround for a bug and it comes with a significant
|
This is a workaround for a bug and it comes with a significant
|
||||||
performance penalty.
|
performance penalty.
|
||||||
|
|
Loading…
Reference in New Issue