From: David-Sarah Hopwood Date: Wed, 20 Mar 2013 01:27:17 +0000 (+0000) Subject: Improve 'tahoe put --help' to clarify behaviour for mutable files, and X-Git-Tag: allmydata-tahoe-1.10a2~9 X-Git-Url: https://git.rkrishnan.org/vdrive/%22news.html/simplejson/$rel_link?a=commitdiff_plain;h=656e8195600f425a46da39de9b3cf72e6e88cd1e;p=tahoe-lafs%2Ftahoe-lafs.git Improve 'tahoe put --help' to clarify behaviour for mutable files, and make sure the documented behaviour is tested. fixes #1372 Signed-off-by: David-Sarah Hopwood --- diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py index 6758fe7d..343a5728 100644 --- a/src/allmydata/scripts/cli.py +++ b/src/allmydata/scripts/cli.py @@ -208,7 +208,11 @@ class PutOptions(VDriveOptions): If REMOTE_FILE is missing, upload the file but do not link it into a directory; also print the new filecap to stdout. If LOCAL_FILE is missing or '-', data will be copied from stdin. REMOTE_FILE is assumed to start - with tahoe: unless otherwise specified.""" + with tahoe: unless otherwise specified. + + If the destination file already exists and is mutable, it will be modified + in-place, whether or not --mutable is specified. (--mutable only affects + creation of new files.)""" def getUsage(self, width=None): t = VDriveOptions.getUsage(self, width) diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index 333da02a..d4c26de8 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -1173,8 +1173,20 @@ class Put(GridTestMixin, CLITestMixin, unittest.TestCase): d = self.do_cli("create-alias", "tahoe") d.addCallback(lambda res: self.do_cli("put", "--mutable", fn1, "tahoe:uploaded.txt")) + def _check(res): + (rc, out, err) = res + self.failUnlessEqual(rc, 0, str(res)) + self.failUnlessEqual(err, "", str(res)) + self.uri = out + d.addCallback(_check) d.addCallback(lambda res: self.do_cli("put", fn2, "tahoe:uploaded.txt")) + def _check2(res): + (rc, out, err) = res + self.failUnlessEqual(rc, 0, str(res)) + self.failUnlessEqual(err, "", str(res)) + self.failUnlessEqual(out, self.uri, str(res)) + d.addCallback(_check2) d.addCallback(lambda res: self.do_cli("get", "tahoe:uploaded.txt")) d.addCallback(lambda (rc,out,err): self.failUnlessReallyEqual(out, DATA2))