Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

index.py: factor out an Entry._fixup_time method.

Factor Entry._fixup_time out of Entry._fixup to reduce (minor) logic
duplication and prepare for upcoming tweaks to timestamp indexing.
  • Loading branch information...
commit 4cb8d3c09194109eb145428002df9e392f9ec7d5 1 parent 56dd471
Aaron M. Ucko authored apenwarr committed
Showing with 10 additions and 8 deletions.
  1. +10 −8 lib/bup/index.py
View
18 lib/bup/index.py
@@ -120,14 +120,16 @@ def _fixup(self):
self.gid += 0x100000000
assert(self.uid >= 0)
assert(self.gid >= 0)
- if self.mtime < -0x80000000: # can happen in NTFS on 64-bit linux
- self.mtime = 0
- if self.ctime < -0x80000000:
- self.ctime = 0
- if self.mtime > 0x7fffffff:
- self.mtime = 0x7fffffff
- if self.ctime > 0x7fffffff:
- self.ctime = 0x7fffffff
+ self.mtime = self._fixup_time(self.mtime)
+ self.ctime = self._fixup_time(self.ctime)
+
+ def _fixup_time(self, t):
+ if t < -0x80000000: # can happen in NTFS on 64-bit linux
+ return 0
+ elif t > 0x7fffffff:
+ return 0x7fffffff
+ else:
+ return t
def is_valid(self):
f = IX_HASHVALID|IX_EXISTS
Please sign in to comment.
Something went wrong with that request. Please try again.