Improve logging, disable progress bar by default
parent
3797aac848
commit
5472f4919a
|
@ -67,14 +67,16 @@ class OgProgressPrinter(git.RemoteProgress):
|
||||||
__del__():
|
__del__():
|
||||||
Ensures a newline is printed when the instance is deleted.
|
Ensures a newline is printed when the instance is deleted.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parentLogger):
|
def __init__(self, parentLogger, use_tqdm = False):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.logger = parentLogger
|
self.logger = parentLogger
|
||||||
|
|
||||||
if sys.stdin.isatty():
|
if sys.stdin.isatty() and use_tqdm:
|
||||||
self.progress = tqdm()
|
self.progress = tqdm()
|
||||||
self.progress.miniters = 1
|
self.progress.miniters = 1
|
||||||
#self.progress.ascii = False
|
#self.progress.ascii = False
|
||||||
|
else:
|
||||||
|
self.progress = None
|
||||||
|
|
||||||
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
|
op = op_code & git.RemoteProgress.OP_MASK
|
||||||
|
@ -105,7 +107,7 @@ class OgProgressPrinter(git.RemoteProgress):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.logger.debug(f"Progress: {op_code} {cur_count}/{max_count}: {message}")
|
self.logger.debug(f"Progress: {op_text} ({op_code}) {cur_count}/{max_count}: {message}")
|
||||||
|
|
||||||
if max_count is None:
|
if max_count is None:
|
||||||
return
|
return
|
||||||
|
@ -1375,10 +1377,12 @@ class OpengnsysGitLibrary:
|
||||||
# repo.heads.master.set_tracking_branch(origin.refs.master)
|
# repo.heads.master.set_tracking_branch(origin.refs.master)
|
||||||
|
|
||||||
self.logger.info("Uploading to ogrepository")
|
self.logger.info("Uploading to ogrepository")
|
||||||
origin.push(progress=OgProgressPrinter(self.logger))
|
|
||||||
|
|
||||||
|
origin.push(progress=OgProgressPrinter(self.logger))
|
||||||
#repo.git.push("--set-upstream", "origin", repo.head.ref, "--force")
|
#repo.git.push("--set-upstream", "origin", repo.head.ref, "--force")
|
||||||
|
|
||||||
|
self.logger.info("initRepo done")
|
||||||
|
|
||||||
def cloneRepo(self, repo_name, destination, boot_device):
|
def cloneRepo(self, repo_name, destination, boot_device):
|
||||||
"""
|
"""
|
||||||
Clones a repository to a specified destination and sets up the bootloader.
|
Clones a repository to a specified destination and sets up the bootloader.
|
||||||
|
@ -1513,9 +1517,10 @@ class OpengnsysGitLibrary:
|
||||||
|
|
||||||
origin = repo.remotes["origin"]
|
origin = repo.remotes["origin"]
|
||||||
repo.heads.master.set_tracking_branch(origin.refs.master)
|
repo.heads.master.set_tracking_branch(origin.refs.master)
|
||||||
origin.push(progress=OgProgressPrinter(self.logger))
|
|
||||||
|
|
||||||
#repo.git.push("--set-upstream", "origin", repo.head.ref, "--force") # force = True)
|
#origin.push(progress=OgProgressPrinter(self.logger))
|
||||||
|
|
||||||
|
repo.git.push("--set-upstream", "origin", repo.head.ref, "--force") # force = True)
|
||||||
|
|
||||||
|
|
||||||
def fetch(self, path = None, device = None):
|
def fetch(self, path = None, device = None):
|
||||||
|
|
Loading…
Reference in New Issue