Skip to content

Commit 6c51057

Browse files
committed
Added basic progress reporting
Progress handling has to be improved, as it only shows upon completion. Still haven't found what's wrong which is likely to be in the way the git module is handling this.
1 parent eac844c commit 6c51057

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

git_repo/services/service.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@ def list_urls(self): # pragma: no cover
4646
class ProgressBar(RemoteProgress): # pragma: no cover
4747
'''Nice looking progress bar for long running commands'''
4848
def setup(self, repo_name):
49-
# self.bar = Bar(message='Pulling from {}'.format(repo_name), suffix='')
50-
pass
49+
self.bar = Bar(message='Pulling from {}'.format(repo_name), suffix='')
5150

5251
def update(self, op_code, cur_count, max_count=100, message=''):
53-
log.info("{}, {}, {}, {}".formatn(op_code, cur_count, max_count, message))
54-
# max_count = int(max_count or 100)
55-
# if max_count != self.bar.max:
56-
# self.bar.max = max_count
57-
# self.bar.goto(int(cur_count))
52+
#log.info("{}, {}, {}, {}".format(op_code, cur_count, max_count, message))
53+
max_count = int(max_count or 100)
54+
if max_count != self.bar.max:
55+
self.bar.max = max_count
56+
self.bar.goto(int(cur_count))
5857

5958

6059
def register_target(repo_cmd, repo_service):
@@ -192,10 +191,13 @@ def pull(self, remote, branch=None):
192191
:param remote: git-remote instance
193192
:param branch: name of the branch to pull
194193
'''
194+
pb = ProgressBar()
195+
pb.setup(self.name)
195196
if branch:
196-
remote.pull(branch)#, progress=ProgressBar())
197+
remote.pull(branch, progress=pb)
197198
else: # pragma: no cover
198-
remote.pull() #progress=ProgressBar())
199+
remote.pull(progress=pb)
200+
print()
199201

200202
def clone(self, user, repo, branch='master'):
201203
'''Clones a new repository

0 commit comments

Comments
 (0)