mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Disable the progress meter when trace is enabled
The trace output often interfers with the progress meter, so its easier to just disable the progress meter if trace is active. Its already verbose enough to let the user know we are working, which is all the progress meter is there for anyway. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
ad3193a0e5
commit
6ed4e28346
@ -14,6 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
from trace import IsTrace
|
||||||
|
|
||||||
class Progress(object):
|
class Progress(object):
|
||||||
def __init__(self, title, total=0):
|
def __init__(self, title, total=0):
|
||||||
@ -25,6 +26,9 @@ class Progress(object):
|
|||||||
def update(self, inc=1):
|
def update(self, inc=1):
|
||||||
self._done += inc
|
self._done += inc
|
||||||
|
|
||||||
|
if IsTrace():
|
||||||
|
return
|
||||||
|
|
||||||
if self._total <= 0:
|
if self._total <= 0:
|
||||||
sys.stderr.write('\r%s: %d, ' % (
|
sys.stderr.write('\r%s: %d, ' % (
|
||||||
self._title,
|
self._title,
|
||||||
@ -43,6 +47,9 @@ class Progress(object):
|
|||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
|
||||||
def end(self):
|
def end(self):
|
||||||
|
if IsTrace():
|
||||||
|
return
|
||||||
|
|
||||||
if self._total <= 0:
|
if self._total <= 0:
|
||||||
sys.stderr.write('\r%s: %d, done. \n' % (
|
sys.stderr.write('\r%s: %d, done. \n' % (
|
||||||
self._title,
|
self._title,
|
||||||
|
Loading…
Reference in New Issue
Block a user