13 import cStringIO |
13 import cStringIO |
14 |
14 |
15 _format = ">cllll" |
15 _format = ">cllll" |
16 propertycache = util.propertycache |
16 propertycache = util.propertycache |
17 filecache = scmutil.filecache |
17 filecache = scmutil.filecache |
|
18 _rangemask = 0x7fffffff |
18 |
19 |
19 class repocache(filecache): |
20 class repocache(filecache): |
20 """filecache for files in .hg/""" |
21 """filecache for files in .hg/""" |
21 def join(self, obj, fname): |
22 def join(self, obj, fname): |
22 return obj._opener.join(fname) |
23 return obj._opener.join(fname) |
332 |
333 |
333 def normal(self, f): |
334 def normal(self, f): |
334 '''Mark a file normal and clean.''' |
335 '''Mark a file normal and clean.''' |
335 s = os.lstat(self._join(f)) |
336 s = os.lstat(self._join(f)) |
336 mtime = int(s.st_mtime) |
337 mtime = int(s.st_mtime) |
337 self._addpath(f, 'n', s.st_mode, s.st_size, mtime) |
338 self._addpath(f, 'n', s.st_mode, |
|
339 s.st_size & _rangemask, mtime & _rangemask) |
338 if f in self._copymap: |
340 if f in self._copymap: |
339 del self._copymap[f] |
341 del self._copymap[f] |
340 if mtime > self._lastnormaltime: |
342 if mtime > self._lastnormaltime: |
341 # Remember the most recent modification timeslot for status(), |
343 # Remember the most recent modification timeslot for status(), |
342 # to make sure we won't miss future size-preserving file content |
344 # to make sure we won't miss future size-preserving file content |
399 def merge(self, f): |
401 def merge(self, f): |
400 '''Mark a file merged.''' |
402 '''Mark a file merged.''' |
401 if self._pl[1] == nullid: |
403 if self._pl[1] == nullid: |
402 return self.normallookup(f) |
404 return self.normallookup(f) |
403 s = os.lstat(self._join(f)) |
405 s = os.lstat(self._join(f)) |
404 self._addpath(f, 'm', s.st_mode, s.st_size, int(s.st_mtime)) |
406 self._addpath(f, 'm', s.st_mode, |
|
407 s.st_size & _rangemask, int(s.st_mtime) & _rangemask) |
405 if f in self._copymap: |
408 if f in self._copymap: |
406 del self._copymap[f] |
409 del self._copymap[f] |
407 |
410 |
408 def drop(self, f): |
411 def drop(self, f): |
409 '''Drop a file from the dirstate''' |
412 '''Drop a file from the dirstate''' |
767 # lines are an expansion of "islink => checklink" |
770 # lines are an expansion of "islink => checklink" |
768 # where islink means "is this a link?" and checklink |
771 # where islink means "is this a link?" and checklink |
769 # means "can we check links?". |
772 # means "can we check links?". |
770 mtime = int(st.st_mtime) |
773 mtime = int(st.st_mtime) |
771 if (size >= 0 and |
774 if (size >= 0 and |
772 (size != st.st_size |
775 ((size != st.st_size and size != st.st_size & _rangemask) |
773 or ((mode ^ st.st_mode) & 0100 and self._checkexec)) |
776 or ((mode ^ st.st_mode) & 0100 and self._checkexec)) |
774 and (mode & lnkkind != lnkkind or self._checklink) |
777 and (mode & lnkkind != lnkkind or self._checklink) |
775 or size == -2 # other parent |
778 or size == -2 # other parent |
776 or fn in self._copymap): |
779 or fn in self._copymap): |
777 madd(fn) |
780 madd(fn) |
778 elif (mtime != time |
781 elif ((time != mtime and time != mtime & _rangemask) |
779 and (mode & lnkkind != lnkkind or self._checklink)): |
782 and (mode & lnkkind != lnkkind or self._checklink)): |
780 ladd(fn) |
783 ladd(fn) |
781 elif mtime == self._lastnormaltime: |
784 elif mtime == self._lastnormaltime: |
782 # fn may have been changed in the same timeslot without |
785 # fn may have been changed in the same timeslot without |
783 # changing its size. This can happen if we quickly do |
786 # changing its size. This can happen if we quickly do |