comparison mercurial/store.py @ 50315:cf6e1d535602 stable

fncache: make it possible to ignore some file In the next changeset, we need to able to ignore some temporary file. This changeset teach the fncache about that.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 20 Mar 2023 11:40:18 +0100
parents 2e726c934fcd
children 4be9ecc982e1
comparison
equal deleted inserted replaced
50314:6487737e0f00 50315:cf6e1d535602
601 class fncache: 601 class fncache:
602 # the filename used to be partially encoded 602 # the filename used to be partially encoded
603 # hence the encodedir/decodedir dance 603 # hence the encodedir/decodedir dance
604 def __init__(self, vfs): 604 def __init__(self, vfs):
605 self.vfs = vfs 605 self.vfs = vfs
606 self._ignores = set()
606 self.entries = None 607 self.entries = None
607 self._dirty = False 608 self._dirty = False
608 # set of new additions to fncache 609 # set of new additions to fncache
609 self.addls = set() 610 self.addls = set()
610 611
685 fp.write(encodedir(b'\n'.join(self.addls) + b'\n')) 686 fp.write(encodedir(b'\n'.join(self.addls) + b'\n'))
686 fp.close() 687 fp.close()
687 self.entries = None 688 self.entries = None
688 self.addls = set() 689 self.addls = set()
689 690
691 def addignore(self, fn):
692 self._ignores.add(fn)
693
690 def add(self, fn): 694 def add(self, fn):
695 if fn in self._ignores:
696 return
691 if self.entries is None: 697 if self.entries is None:
692 self._load() 698 self._load()
693 if fn not in self.entries: 699 if fn not in self.entries:
694 self.addls.add(fn) 700 self.addls.add(fn)
695 701