summaryrefslogtreecommitdiffstats
path: root/combox/silo.py
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-02-26 02:30:06 -0500
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-02-26 02:30:06 -0500
commitec1b156cd7926e5845c8b6b16762e5fc57ea3a8b (patch)
tree97444c1be6118571a65800788363b6ac420cd217 /combox/silo.py
parent694240de5d0c803b866c1b633ac5b521f32ee111 (diff)
updated combox.silo.ComboxSilo.stale method - added new arg fhash
- the arg `fhash' is set to None by default. - if `fhash' is not None, it is considered as file's current hash. modified: combox/silo.py modified: tests/silo_test.py
Diffstat (limited to 'combox/silo.py')
-rw-r--r--combox/silo.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/combox/silo.py b/combox/silo.py
index b1e59f6..21b473d 100644
--- a/combox/silo.py
+++ b/combox/silo.py
@@ -84,17 +84,19 @@ class ComboxSilo(object):
return True
- def stale(self, filep):
+ def stale(self, filep, fhash=None):
"""Returns True if filep's hash is different from the hash stored in db.
Returns None, if filep's info is not yet stored in db.
Returns False, if filep's hash has not changed it.
filep: path to the file in combox directory.
-
+ fhash: If not None, it is assumed to be filep's hash.
"""
- fhash = hash_file(filep)
+ if not fhash:
+ fhash = hash_file(filep)
+
fhash_in_db = self.db.get(filep)
if fhash_in_db is None: