##// END OF EJS Templates
store: only add new entries to the fncache file...
Adrian Buehlmann -
r10577:d5bd1bef stable
parent child Browse files
Show More
@@ -267,7 +267,9 b' class fncache(object):'
267 def add(self, fn):
267 def add(self, fn):
268 if self.entries is None:
268 if self.entries is None:
269 self._load()
269 self._load()
270 if fn not in self.entries:
270 self.opener('fncache', 'ab').write(encodedir(fn) + '\n')
271 self.opener('fncache', 'ab').write(encodedir(fn) + '\n')
272 self.entries.add(fn)
271
273
272 def __contains__(self, fn):
274 def __contains__(self, fn):
273 if self.entries is None:
275 if self.entries is None:
@@ -290,9 +292,7 b' class fncachestore(basicstore):'
290 self.fncache = fnc
292 self.fncache = fnc
291
293
292 def fncacheopener(path, mode='r', *args, **kw):
294 def fncacheopener(path, mode='r', *args, **kw):
293 if (mode not in ('r', 'rb')
295 if mode not in ('r', 'rb') and path.startswith('data/'):
294 and path.startswith('data/')
295 and path not in fnc):
296 fnc.add(path)
296 fnc.add(path)
297 return op(hybridencode(path), mode, *args, **kw)
297 return op(hybridencode(path), mode, *args, **kw)
298 self.opener = fncacheopener
298 self.opener = fncacheopener
@@ -56,4 +56,10 b' hg convert --source-type foo a a-foo'
56 echo % convert with imaginary sink type
56 echo % convert with imaginary sink type
57 hg convert --dest-type foo a a-foo
57 hg convert --dest-type foo a a-foo
58
58
59 echo
60 echo % "testing: convert must not produce duplicate entries in fncache"
61 hg convert a b
62 echo % "contents of fncache file:"
63 cat b/.hg/store/fncache
64
59 true
65 true
@@ -273,3 +273,17 b' initializing destination a-foo repositor'
273 abort: foo: invalid source repository type
273 abort: foo: invalid source repository type
274 % convert with imaginary sink type
274 % convert with imaginary sink type
275 abort: foo: invalid destination repository type
275 abort: foo: invalid destination repository type
276
277 % testing: convert must not produce duplicate entries in fncache
278 initializing destination b repository
279 scanning source...
280 sorting...
281 converting...
282 4 a
283 3 b
284 2 c
285 1 d
286 0 e
287 % contents of fncache file:
288 data/a.i
289 data/b.i
General Comments 0
You need to be logged in to leave comments. Login now