comparison mercurial/filelog.py @ 50634:32837c7e2e4b

revlog: add a `get_revlog` method This might seen weird, but I actually thing we have been needing this for a long time. There is multiple object that kind of pretend being revlogs while actually wrapping the actual revlog. Since multiple code needs to access the actuel revlog. See documentation for more details. Expect cleanup of various places one the current series is done.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 28 May 2023 05:23:46 +0200
parents 87f0155d68aa
children 33d2f0164d0d
comparison
equal deleted inserted replaced
50633:c90ea9bbf327 50634:32837c7e2e4b
39 # Used by LFS. 39 # Used by LFS.
40 self._revlog.filename = path 40 self._revlog.filename = path
41 self.nullid = self._revlog.nullid 41 self.nullid = self._revlog.nullid
42 opts = opener.options 42 opts = opener.options
43 self._fix_issue6528 = opts.get(b'issue6528.fix-incoming', True) 43 self._fix_issue6528 = opts.get(b'issue6528.fix-incoming', True)
44
45 def get_revlog(self):
46 """return an actual revlog instance if any
47
48 This exist because a lot of code leverage the fact the underlying
49 storage is a revlog for optimization, so giving simple way to access
50 the revlog instance helps such code.
51 """
52 return self._revlog
44 53
45 def __len__(self): 54 def __len__(self):
46 return len(self._revlog) 55 return len(self._revlog)
47 56
48 def __iter__(self): 57 def __iter__(self):