]> arthur.barton.de Git - bup.git/commitdiff
Handle missing files more gracefully in "bup xstat".
authorRob Browning <rlb@defaultvalue.org>
Wed, 26 Jan 2011 00:50:38 +0000 (18:50 -0600)
committerRob Browning <rlb@defaultvalue.org>
Wed, 26 Jan 2011 00:50:49 +0000 (18:50 -0600)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
cmd/xstat-cmd.py

index 62f8bbff9a803acd3184d94b1fed565b6dda588c..b8ee4e808b32bbb73a5e0c9b9ccfc9704032661e 100755 (executable)
@@ -5,13 +5,14 @@
 # This code is covered under the terms of the GNU Library General
 # Public License as described in the bup LICENSE file.
 
+import errno
 import posix1e
 import stat
 import sys
 from bup import metadata
 from bup import options
 from bup import xstat
-from bup.helpers import handle_ctrl_c, saved_errors
+from bup.helpers import handle_ctrl_c, saved_errors, add_error, log
 
 
 def fstimestr(fstime):
@@ -78,7 +79,14 @@ for flag, value in flags:
             active_fields = active_fields | include_fields
 
 for path in remainder:
-    m = metadata.from_path(path, archive_path = path)
+    try:
+        m = metadata.from_path(path, archive_path = path)
+    except IOError, e:
+        if e.errno == errno.ENOENT:
+            add_error(e)
+            continue
+        else:
+            raise
     if 'path' in active_fields:
         print 'path:', m.path
     if 'mode' in active_fields: