diff --git a/gitlib/gitlib.py b/gitlib/gitlib.py index 48dad07..c33e8ed 100755 --- a/gitlib/gitlib.py +++ b/gitlib/gitlib.py @@ -67,14 +67,16 @@ class OgProgressPrinter(git.RemoteProgress): __del__(): Ensures a newline is printed when the instance is deleted. """ - def __init__(self, parentLogger): + def __init__(self, parentLogger, use_tqdm = False): super().__init__() self.logger = parentLogger - if sys.stdin.isatty(): + if sys.stdin.isatty() and use_tqdm: self.progress = tqdm() self.progress.miniters = 1 #self.progress.ascii = False + else: + self.progress = None def update(self, op_code, cur_count, max_count=None, message=""): 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: return @@ -1375,10 +1377,12 @@ class OpengnsysGitLibrary: # repo.heads.master.set_tracking_branch(origin.refs.master) 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") + self.logger.info("initRepo done") + def cloneRepo(self, repo_name, destination, boot_device): """ Clones a repository to a specified destination and sets up the bootloader. @@ -1513,9 +1517,10 @@ class OpengnsysGitLibrary: origin = repo.remotes["origin"] 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):