|
|
@@ -490,7 +490,14 @@ class ObjectStore(object): |
|
|
|
return self._hashes[h] |
|
|
|
|
|
|
|
def by_file(self, fname, types=('metadata', )): |
|
|
|
'''Return a metadata object for the file named fname.''' |
|
|
|
'''Return a metadata object for the file named fname. |
|
|
|
|
|
|
|
Will raise a KeyError if this file does not exist in |
|
|
|
the database. |
|
|
|
|
|
|
|
Will raise a ValueError if fname currently does not |
|
|
|
match what is in the database. |
|
|
|
''' |
|
|
|
|
|
|
|
fid = FileObject.make_id(fname) |
|
|
|
|
|
|
@@ -556,7 +563,9 @@ class FileObject(MDBase): |
|
|
|
|
|
|
|
def verify(self, complete=False): |
|
|
|
'''Verify that this FileObject is still valid. It will |
|
|
|
by default, only do a mtime verification.''' |
|
|
|
by default, only do a mtime verification. |
|
|
|
|
|
|
|
It will raise a ValueError if the file does not match.''' |
|
|
|
|
|
|
|
s = os.stat(os.path.join(self.dir, self.filename)) |
|
|
|
mtimets = datetime.datetime.fromtimestamp(s.st_mtime, |
|
|
@@ -728,6 +737,12 @@ def cmd_list(options): |
|
|
|
#print >>sys.stderr, `j._obj` |
|
|
|
for k, v in _iterdictlist(j): |
|
|
|
print('%s:\t%s' % (k, v)) |
|
|
|
|
|
|
|
# This is needed so that if it creates a FileObj, which may be |
|
|
|
# expensive (hashing large file), that it gets saved. |
|
|
|
|
|
|
|
write_objstore(options, objstr) |
|
|
|
|
|
|
|
def main(): |
|
|
|
import argparse |
|
|
|
|
|
|
|