]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blobdiff - src/allmydata/scripts/tahoe_put.py
cli: teach CLI how to create MDMF mutable files
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / scripts / tahoe_put.py
index eb578becbbd8ea2ca868c6bc531d9b9587a54cfd..3dc13773fa75a8a62c97e9c4bce68451330940a5 100644 (file)
@@ -18,6 +18,10 @@ def put(options):
     from_file = options.from_file
     to_file = options.to_file
     mutable = options['mutable']
+    mutable_type = False
+
+    if mutable:
+        mutable_type = options['mutable-type']
     if options['quiet']:
         verbosity = 0
     else:
@@ -42,8 +46,8 @@ def put(options):
         #  DIRCAP:./subdir/foo : DIRCAP/subdir/foo
         #  MUTABLE-FILE-WRITECAP : filecap
 
-        # FIXME: this shouldn't rely on a particular prefix.
-        if to_file.startswith("URI:SSK:"):
+        # FIXME: don't hardcode cap format.
+        if to_file.startswith("URI:MDMF:") or to_file.startswith("URI:SSK:"):
             url = nodeurl + "uri/%s" % urllib.quote(to_file)
         else:
             try:
@@ -64,6 +68,10 @@ def put(options):
         url = nodeurl + "uri"
     if mutable:
         url += "?mutable=true"
+    if mutable_type:
+        assert mutable
+        url += "&mutable-type=%s" % mutable_type
+
     if from_file:
         infileobj = open(os.path.expanduser(from_file), "rb")
     else: