diff options
-rw-r--r-- | progress.py | 6 | ||||
-rw-r--r-- | subcmds/stage.py | 4 | ||||
-rw-r--r-- | subcmds/sync.py | 7 | ||||
-rw-r--r-- | subcmds/upload.py | 4 |
4 files changed, 12 insertions, 9 deletions
diff --git a/progress.py b/progress.py index b08f52e5..0dd5d1a8 100644 --- a/progress.py +++ b/progress.py | |||
@@ -21,7 +21,8 @@ from trace import IsTrace | |||
21 | _NOT_TTY = not os.isatty(2) | 21 | _NOT_TTY = not os.isatty(2) |
22 | 22 | ||
23 | class Progress(object): | 23 | class Progress(object): |
24 | def __init__(self, title, total=0, units='', print_newline=False): | 24 | def __init__(self, title, total=0, units='', print_newline=False, |
25 | always_print_percentage=False): | ||
25 | self._title = title | 26 | self._title = title |
26 | self._total = total | 27 | self._total = total |
27 | self._done = 0 | 28 | self._done = 0 |
@@ -30,6 +31,7 @@ class Progress(object): | |||
30 | self._show = False | 31 | self._show = False |
31 | self._units = units | 32 | self._units = units |
32 | self._print_newline = print_newline | 33 | self._print_newline = print_newline |
34 | self._always_print_percentage = always_print_percentage | ||
33 | 35 | ||
34 | def update(self, inc=1): | 36 | def update(self, inc=1): |
35 | self._done += inc | 37 | self._done += inc |
@@ -51,7 +53,7 @@ class Progress(object): | |||
51 | else: | 53 | else: |
52 | p = (100 * self._done) / self._total | 54 | p = (100 * self._done) / self._total |
53 | 55 | ||
54 | if self._lastp != p: | 56 | if self._lastp != p or self._always_print_percentage: |
55 | self._lastp = p | 57 | self._lastp = p |
56 | sys.stderr.write('\r%s: %3d%% (%d%s/%d%s)%s' % ( | 58 | sys.stderr.write('\r%s: %3d%% (%d%s/%d%s)%s' % ( |
57 | self._title, | 59 | self._title, |
diff --git a/subcmds/stage.py b/subcmds/stage.py index 28849764..9d354268 100644 --- a/subcmds/stage.py +++ b/subcmds/stage.py | |||
@@ -60,8 +60,8 @@ The '%prog' command stages files to prepare the next commit. | |||
60 | out.nl() | 60 | out.nl() |
61 | 61 | ||
62 | for i in range(len(all_projects)): | 62 | for i in range(len(all_projects)): |
63 | p = all_projects[i] | 63 | project = all_projects[i] |
64 | out.write('%3d: %s', i + 1, p.relpath + '/') | 64 | out.write('%3d: %s', i + 1, project.relpath + '/') |
65 | out.nl() | 65 | out.nl() |
66 | out.nl() | 66 | out.nl() |
67 | 67 | ||
diff --git a/subcmds/sync.py b/subcmds/sync.py index d4432ce8..8de730bc 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -357,7 +357,8 @@ later is required to fix a server side protocol bug. | |||
357 | fetched = set() | 357 | fetched = set() |
358 | lock = _threading.Lock() | 358 | lock = _threading.Lock() |
359 | pm = Progress('Fetching projects', len(projects), | 359 | pm = Progress('Fetching projects', len(projects), |
360 | print_newline=not(opt.quiet)) | 360 | print_newline=not(opt.quiet), |
361 | always_print_percentage=opt.quiet) | ||
361 | 362 | ||
362 | objdir_project_map = dict() | 363 | objdir_project_map = dict() |
363 | for project in projects: | 364 | for project in projects: |
@@ -780,8 +781,8 @@ later is required to fix a server side protocol bug. | |||
780 | # generate a new args list to represent the opened projects. | 781 | # generate a new args list to represent the opened projects. |
781 | # TODO: make this more reliable -- if there's a project name/path overlap, | 782 | # TODO: make this more reliable -- if there's a project name/path overlap, |
782 | # this may choose the wrong project. | 783 | # this may choose the wrong project. |
783 | args = [os.path.relpath(self.manifest.paths[p].worktree, os.getcwd()) | 784 | args = [os.path.relpath(self.manifest.paths[path].worktree, os.getcwd()) |
784 | for p in opened_projects] | 785 | for path in opened_projects] |
785 | if not args: | 786 | if not args: |
786 | return | 787 | return |
787 | all_projects = self.GetProjects(args, | 788 | all_projects = self.GetProjects(args, |
diff --git a/subcmds/upload.py b/subcmds/upload.py index 38c061df..fa80c3d2 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -464,8 +464,8 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
464 | self.manifest.topdir, | 464 | self.manifest.topdir, |
465 | self.manifest.manifestProject.GetRemote('origin').url, | 465 | self.manifest.manifestProject.GetRemote('origin').url, |
466 | abort_if_user_denies=True) | 466 | abort_if_user_denies=True) |
467 | pending_proj_names = [project.name for (project, avail) in pending] | 467 | pending_proj_names = [project.name for (project, available) in pending] |
468 | pending_worktrees = [project.worktree for (project, avail) in pending] | 468 | pending_worktrees = [project.worktree for (project, available) in pending] |
469 | try: | 469 | try: |
470 | hook.Run(opt.allow_all_hooks, project_list=pending_proj_names, | 470 | hook.Run(opt.allow_all_hooks, project_list=pending_proj_names, |
471 | worktree_list=pending_worktrees) | 471 | worktree_list=pending_worktrees) |