Squeeze extra blank lines when dumping metadata logs.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Fri, 11 Apr 2008 01:10:03 +0000 (18:10 -0700)
committerMichael Vrable <mvrable@turin.ucsd.edu>
Fri, 11 Apr 2008 01:10:03 +0000 (18:10 -0700)
In lbs-util, squeeze out extra blank lines in the output of the
read-metadata command.  Extra blank lines may appear in the input,
particularly when delta-encoding metadata logs, but to produce
uniform-looking outputs, delete these extra blank lines.

lbs-util

index d617705..942a601 100755 (executable)
--- a/lbs-util
+++ b/lbs-util
@@ -126,7 +126,13 @@ def cmd_read_metadata(snapshot):
     d = lbs.parse_full(store.load_snapshot(snapshot))
     check_version(d['Format'])
     metadata = lbs.read_metadata(store, d['Root'])
+    blank = True
     for l in metadata:
+        if l == '\n':
+            if blank: continue
+            blank = True
+        else:
+            blank = False
         sys.stdout.write(l)
     store.cleanup()