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

.

parent 6ffc9a52
......@@ -161,26 +161,26 @@ class tDB:
# path returns path for object on wcfs.
# - str: wcfs root + obj;
# - Persistent: wcfs root + (head|@<rev>)/bigfile/obj
def path(t, obj, rev=None):
# - Persistent: wcfs root + (head|@<at>)/bigfile/obj
def path(t, obj, at=None):
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))
rev = None
at = None
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)
# read reads file corresponding to obj on wcfs
def read(t, obj, rev=None):
path = t.path(obj, rev=rev)
def read(t, obj, at=None):
path = t.path(obj, at=at)
return readfile(path)
# stat stats file corresponding to obj on wcfs
def stat(t, obj, rev=None):
path = t.path(obj, rev=rev)
def stat(t, obj, at=None):
path = t.path(obj, at=at)
return os.stat(path)
......@@ -277,12 +277,12 @@ def test_wcfs():
# f @tcommit1
st = t.stat(f, rev=tcommit1)
st = t.stat(f, at=tcommit1)
assert st.st_size == fsize1
#assert st.st_mtime == tidtime(tcommit1) FIXME mtime for @revX -> = revX ?
#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
for i in range(hole):
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