浏览代码

Fix test suite breakage

Jonas Borgström 11 年之前
父节点
当前提交
243481f6da
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      attic/cache.py

+ 4 - 3
attic/cache.py

@@ -5,7 +5,8 @@ import os
 from binascii import hexlify
 from binascii import hexlify
 import shutil
 import shutil
 
 
-from .helpers import Error, get_cache_dir, decode_dict, st_mtime_ns, unhexlify, UpgradableLock
+from .helpers import Error, get_cache_dir, decode_dict, st_mtime_ns, unhexlify, UpgradableLock, int_to_bigint, \
+    bigint_to_int
 from .hashindex import ChunkIndex
 from .hashindex import ChunkIndex
 
 
 
 
@@ -210,7 +211,7 @@ class Cache(object):
         if not entry:
         if not entry:
             return None
             return None
         entry = msgpack.unpackb(entry)
         entry = msgpack.unpackb(entry)
-        if entry[1] == st.st_ino and entry[2] == st.st_size and entry[3] == st_mtime_ns(st):
+        if entry[2] == st.st_size and bigint_to_int(entry[3]) == st_mtime_ns(st) and entry[1] == st.st_ino:
             # reset entry age
             # reset entry age
             entry[0] = 0
             entry[0] = 0
             self.files[path_hash] = msgpack.packb(entry)
             self.files[path_hash] = msgpack.packb(entry)
@@ -221,5 +222,5 @@ class Cache(object):
     def memorize_file(self, path_hash, st, ids):
     def memorize_file(self, path_hash, st, ids):
         # Entry: Age, inode, size, mtime, chunk ids
         # Entry: Age, inode, size, mtime, chunk ids
         mtime_ns = st_mtime_ns(st)
         mtime_ns = st_mtime_ns(st)
-        self.files[path_hash] = msgpack.packb((0, st.st_ino, st.st_size, mtime_ns, ids))
+        self.files[path_hash] = msgpack.packb((0, st.st_ino, st.st_size, int_to_bigint(mtime_ns), ids))
         self._newest_mtime = max(self._newest_mtime, mtime_ns)
         self._newest_mtime = max(self._newest_mtime, mtime_ns)