From 68194f42b0b0e59f206b8e997c26f6a16b74fd4f Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 10 Apr 2009 16:48:52 -0700 Subject: Add a project progress meter to 'repo sync' This way users can see how much is left during fetch. Its especially useful when most syncs are no-ops but there are hundreds of repositories to poll. Signed-off-by: Shawn O. Pearce --- subcmds/sync.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'subcmds/sync.py') diff --git a/subcmds/sync.py b/subcmds/sync.py index 21e0899a..79ffcf51 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -23,6 +23,7 @@ from git_command import GIT from command import Command, MirrorSafeCommand from error import RepoChangedException, GitError from project import R_HEADS +from progress import Progress class Sync(Command, MirrorSafeCommand): common = True @@ -71,12 +72,16 @@ revision is temporarily needed. def _Fetch(self, *projects): fetched = set() + pm = Progress('Fetching projects', len(projects)) for project in projects: + pm.update() + if project.Sync_NetworkHalf(): fetched.add(project.gitdir) else: print >>sys.stderr, 'error: Cannot fetch %s' % project.name sys.exit(1) + pm.end() return fetched def Execute(self, opt, args): @@ -130,12 +135,14 @@ revision is temporarily needed. missing.append(project) self._Fetch(*missing) + pm = Progress('Syncing work tree', len(all)) for project in all: + pm.update() if project.worktree: if not project.Sync_LocalHalf( detach_head=opt.detach_head): sys.exit(1) - + pm.end() def _VerifyTag(project): gpg_dir = os.path.expanduser('~/.repoconfig/gnupg') -- cgit v1.2.3-54-g00ecf