##// END OF EJS Templates
dirstate: refactor granularity code, add a test...
Matt Mackall -
r6327:6d952dc2 default
parent child Browse files
Show More
@@ -0,0 +1,15 b''
1 #!/bin/sh
2
3 mkdir t
4 cd t
5 hg init
6 echo a > a
7 hg add a
8 hg commit -m test
9
10 # do we ever miss a sub-second change?
11 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
12 hg co -qC 0
13 echo b > a
14 hg st
15 done
@@ -0,0 +1,20 b''
1 M a
2 M a
3 M a
4 M a
5 M a
6 M a
7 M a
8 M a
9 M a
10 M a
11 M a
12 M a
13 M a
14 M a
15 M a
16 M a
17 M a
18 M a
19 M a
20 M a
@@ -66,12 +66,6 b' class dirstate(object):'
66 66 elif name == '_checkexec':
67 67 self._checkexec = util.checkexec(self._root)
68 68 return self._checkexec
69 elif name == '_limit':
70 try:
71 self._limit = int(self._ui.config('ui', 'limit', 1))
72 except ValueError:
73 self._limit = 1
74 return self._limit
75 69 else:
76 70 raise AttributeError, name
77 71
@@ -342,10 +336,15 b' class dirstate(object):'
342 336 if not self._dirty:
343 337 return
344 338 st = self._opener("dirstate", "w", atomictemp=True)
345 if self._limit > 0:
346 limit = util.fstat(st).st_mtime - self._limit
347 else:
339
340 try:
341 gran = int(self._ui.config('dirstate', 'granularity', 1))
342 except ValueError:
343 gran = 1
348 344 limit = sys.maxint
345 if gran > 0:
346 limit = util.fstat(st).st_mtime - gran
347
349 348 cs = cStringIO.StringIO()
350 349 copymap = self._copymap
351 350 pack = struct.pack
General Comments 0
You need to be logged in to leave comments. Login now