]> arthur.barton.de Git - bup.git/blobdiff - cmd-join.py
bup join: continue gracefully if one of the requested files does not exist.
[bup.git] / cmd-join.py
index 07dfdcd238b22eb551468aafcd855be1b4344c97..26f390c43ce3efa581d38f39b96782695f591b64 100755 (executable)
@@ -18,15 +18,22 @@ git.check_repo_or_die()
 if not extra:
     extra = linereader(sys.stdin)
 
+ret = 0
+
 if opt.remote:
     cli = client.Client(opt.remote)
-    for id in extra:
-        for blob in cli.cat(id):
-            sys.stdout.write(blob)
-    cli.close()
+    cat = cli.cat
 else:
     cp = git.CatPipe()
-    for id in extra:
-        #log('id=%r\n' % id)
-        for blob in cp.join(id):
+    cat = cp.join
+
+for id in extra:
+    try:
+        for blob in cat(id):
             sys.stdout.write(blob)
+    except KeyError, e:
+        sys.stdout.flush()
+        log('error: %s\n' % e)
+        ret = 1
+
+sys.exit(ret)