Commit 4545ce8a authored by owsla's avatar owsla

flush stdout before running other commands, and add a --quiet option


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@890 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 8b379585
New in v1.1.16 (????/??/??)
---------------------------
rdiff-backup-statistics enhancements suggested by James Marsh: flush stdout
before running other commands, and add a --quiet option to suppress printing
the "Processing statistics from session..." lines. (Andrew Ferguson)
Don't set modification times for directories on Windows. Also, assume
that user has access to all files on Windows since there is no support
for getuid(). (Patch from Josh Nisly)
......
......@@ -28,11 +28,12 @@ begin_time = None # Parse statistics at or after this time...
end_time = None # ... and at or before this time (epoch seconds)
min_ratio = .05 # report only files/directories over this number
separator = "\n" # The line separator in file_statistics file
quiet = False # Suppress the "Processing statistics from session ..." lines
def parse_args():
global begin_time, end_time, min_ratio, separator
global begin_time, end_time, min_ratio, separator, quiet
try: optlist, args = getopt.getopt(sys.argv[1:], "",
["begin-time=", "end-time=", "minimum-ratio=", "null-separator"])
["begin-time=", "end-time=", "minimum-ratio=", "null-separator", "quiet"])
except getopt.error, e:
sys.exit("Bad command line: " + str(e))
......@@ -41,6 +42,7 @@ def parse_args():
elif opt == "--end-time": end_time = Time.genstrtotime(arg)
elif opt == "--minimum-ratio": min_ratio = float(arg)
elif opt == "--null-separator": separator = '\0'
elif opt == "--quiet": quiet = True
else: assert 0
if len(args) != 1:
......@@ -56,6 +58,7 @@ def parse_args():
if len(sys.argv) == 3: tag = sys.argv[2]
def system(cmd):
sys.stdout.flush()
if os.system(cmd): sys.exit("Error running command '%s'\n" % (cmd,))
......@@ -406,11 +409,12 @@ class ReadlineBuffer:
def sum_fst(rp_pairs):
"""Add the file statistics given as list of (session_rp, file_rp) pairs"""
global quiet
n = len(rp_pairs)
print "Processing statistics from session 1 of %d" % (n,)
if not quiet: print "Processing statistics from session 1 of %d" % (n,)
total_fst = make_fst(*rp_pairs[0])
for i in range(1, n):
print "Processing statistics from session %d of %d" % (i+1, n)
if not quiet: print "Processing statistics from session %d of %d" % (i+1, n)
session_rp, filestat_rp = rp_pairs[i]
fst = make_fst(session_rp, filestat_rp)
total_fst += fst
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment