Commit 16dea9d0 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6ffc9a52
...@@ -161,26 +161,26 @@ class tDB: ...@@ -161,26 +161,26 @@ class tDB:
# path returns path for object on wcfs. # path returns path for object on wcfs.
# - str: wcfs root + obj; # - str: wcfs root + obj;
# - Persistent: wcfs root + (head|@<rev>)/bigfile/obj # - Persistent: wcfs root + (head|@<at>)/bigfile/obj
def path(t, obj, rev=None): def path(t, obj, at=None):
if isinstance(obj, Persistent): if isinstance(obj, Persistent):
head = "head/" if rev is None else ("@%s/" % h(rev)) head = "head/" if at is None else ("@%s/" % h(at))
obj = "%s/bigfile/%s" % (head, h(obj._p_oid)) obj = "%s/bigfile/%s" % (head, h(obj._p_oid))
rev = None at = None
assert isinstance(obj, str) assert isinstance(obj, str)
assert rev is None # must not be used with str assert at is None # must not be used with str
return os.path.join(t.wc.mountpoint, obj) return os.path.join(t.wc.mountpoint, obj)
# read reads file corresponding to obj on wcfs # read reads file corresponding to obj on wcfs
def read(t, obj, rev=None): def read(t, obj, at=None):
path = t.path(obj, rev=rev) path = t.path(obj, at=at)
return readfile(path) return readfile(path)
# stat stats file corresponding to obj on wcfs # stat stats file corresponding to obj on wcfs
def stat(t, obj, rev=None): def stat(t, obj, at=None):
path = t.path(obj, rev=rev) path = t.path(obj, at=at)
return os.stat(path) return os.stat(path)
...@@ -277,12 +277,12 @@ def test_wcfs(): ...@@ -277,12 +277,12 @@ def test_wcfs():
# f @tcommit1 # f @tcommit1
st = t.stat(f, rev=tcommit1) st = t.stat(f, at=tcommit1)
assert st.st_size == fsize1 assert st.st_size == fsize1
#assert st.st_mtime == tidtime(tcommit1) FIXME mtime for @revX -> = revX ? #assert st.st_mtime == tidtime(tcommit1) FIXME mtime for @revX -> = revX ?
#assert readfile(fpath + "/at") == h(tcommit1) XXX do we need it? #assert readfile(fpath + "/at") == h(tcommit1) XXX do we need it?
data = t.read(f, rev=tcommit1) data = t.read(f, at=tcommit1)
assert len(data) == fsize1 assert len(data) == fsize1
for i in range(hole): for i in range(hole):
assert data[i*blksize:(i+1)*blksize] == b'\0'*blksize assert data[i*blksize:(i+1)*blksize] == b'\0'*blksize
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment