]> arthur.barton.de Git - bup.git/blobdiff - cmd/join-cmd.py
cleanup-mounts-under: Don't fail when /proc/mounts isn't readable
[bup.git] / cmd / join-cmd.py
index 81febac4b23c39b3cd3d973e93064eb9f477bd45..042b4023de5af8ad4cd8425e96292d7346d6fc36 100755 (executable)
@@ -8,8 +8,9 @@ optspec = """
 bup join [-r host:path] [refs or hashes...]
 --
 r,remote=  remote repository path
+o=         output filename
 """
-o = options.Options('bup join', optspec)
+o = options.Options(optspec)
 (opt, flags, extra) = o.parse(sys.argv[1:])
 
 git.check_repo_or_die()
@@ -26,12 +27,17 @@ else:
     cp = git.CatPipe()
     cat = cp.join
 
+if opt.o:
+    outfile = open(opt.o, 'wb')
+else:
+    outfile = sys.stdout
+
 for id in extra:
     try:
         for blob in cat(id):
-            sys.stdout.write(blob)
+            outfile.write(blob)
     except KeyError, e:
-        sys.stdout.flush()
+        outfile.flush()
         log('error: %s\n' % e)
         ret = 1