comparison mercurial/manifest.py @ 48946:642e31cb55f0

py3: use class X: instead of class X(object): The inheritance from object is implied in Python 3. So this should be equivalent. This change was generated via an automated search and replace. So there may have been some accidental changes. Differential Revision: https://phab.mercurial-scm.org/D12352
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 21 Feb 2022 13:08:28 -0700
parents 3d35e7483602
children b5858e02e3ba
comparison
equal deleted inserted replaced
48945:55d132525155 48946:642e31cb55f0
82 82
83 _checkforbidden(files) 83 _checkforbidden(files)
84 return b''.join(lines) 84 return b''.join(lines)
85 85
86 86
87 class lazymanifestiter(object): 87 class lazymanifestiter:
88 def __init__(self, lm): 88 def __init__(self, lm):
89 self.pos = 0 89 self.pos = 0
90 self.lm = lm 90 self.lm = lm
91 91
92 def __iter__(self): 92 def __iter__(self):
105 return data[pos:zeropos] 105 return data[pos:zeropos]
106 106
107 __next__ = next 107 __next__ = next
108 108
109 109
110 class lazymanifestiterentries(object): 110 class lazymanifestiterentries:
111 def __init__(self, lm): 111 def __init__(self, lm):
112 self.lm = lm 112 self.lm = lm
113 self.pos = 0 113 self.pos = 0
114 114
115 def __iter__(self): 115 def __iter__(self):
156 156
157 157
158 _manifestflags = {b'', b'l', b't', b'x'} 158 _manifestflags = {b'', b'l', b't', b'x'}
159 159
160 160
161 class _lazymanifest(object): 161 class _lazymanifest:
162 """A pure python manifest backed by a byte string. It is supplimented with 162 """A pure python manifest backed by a byte string. It is supplimented with
163 internal lists as it is modified, until it is compacted back to a pure byte 163 internal lists as it is modified, until it is compacted back to a pure byte
164 string. 164 string.
165 165
166 ``data`` is the initial manifest data. 166 ``data`` is the initial manifest data.
471 except AttributeError: 471 except AttributeError:
472 pass 472 pass
473 473
474 474
475 @interfaceutil.implementer(repository.imanifestdict) 475 @interfaceutil.implementer(repository.imanifestdict)
476 class manifestdict(object): 476 class manifestdict:
477 def __init__(self, nodelen, data=b''): 477 def __init__(self, nodelen, data=b''):
478 self._nodelen = nodelen 478 self._nodelen = nodelen
479 self._lm = _lazymanifest(nodelen, data) 479 self._lm = _lazymanifest(nodelen, data)
480 480
481 def __getitem__(self, key): 481 def __getitem__(self, key):
794 794
795 _noop = lambda s: None 795 _noop = lambda s: None
796 796
797 797
798 @interfaceutil.implementer(repository.imanifestdict) 798 @interfaceutil.implementer(repository.imanifestdict)
799 class treemanifest(object): 799 class treemanifest:
800 def __init__(self, nodeconstants, dir=b'', text=b''): 800 def __init__(self, nodeconstants, dir=b'', text=b''):
801 self._dir = dir 801 self._dir = dir
802 self.nodeconstants = nodeconstants 802 self.nodeconstants = nodeconstants
803 self._node = self.nodeconstants.nullid 803 self._node = self.nodeconstants.nullid
804 self._nodelen = self.nodeconstants.nodelen 804 self._nodelen = self.nodeconstants.nodelen
1548 class FastdeltaUnavailable(Exception): 1548 class FastdeltaUnavailable(Exception):
1549 """Exception raised when fastdelta isn't usable on a manifest.""" 1549 """Exception raised when fastdelta isn't usable on a manifest."""
1550 1550
1551 1551
1552 @interfaceutil.implementer(repository.imanifeststorage) 1552 @interfaceutil.implementer(repository.imanifeststorage)
1553 class manifestrevlog(object): 1553 class manifestrevlog:
1554 """A revlog that stores manifest texts. This is responsible for caching the 1554 """A revlog that stores manifest texts. This is responsible for caching the
1555 full-text manifest contents. 1555 full-text manifest contents.
1556 """ 1556 """
1557 1557
1558 def __init__( 1558 def __init__(
1906 def opener(self, value): 1906 def opener(self, value):
1907 self._revlog.opener = value 1907 self._revlog.opener = value
1908 1908
1909 1909
1910 @interfaceutil.implementer(repository.imanifestlog) 1910 @interfaceutil.implementer(repository.imanifestlog)
1911 class manifestlog(object): 1911 class manifestlog:
1912 """A collection class representing the collection of manifest snapshots 1912 """A collection class representing the collection of manifest snapshots
1913 referenced by commits in the repository. 1913 referenced by commits in the repository.
1914 1914
1915 In this situation, 'manifest' refers to the abstract concept of a snapshot 1915 In this situation, 'manifest' refers to the abstract concept of a snapshot
1916 of the list of files in the given commit. Consumers of the output of this 1916 of the list of files in the given commit. Consumers of the output of this
2005 def update_caches(self, transaction): 2005 def update_caches(self, transaction):
2006 return self._rootstore._revlog.update_caches(transaction=transaction) 2006 return self._rootstore._revlog.update_caches(transaction=transaction)
2007 2007
2008 2008
2009 @interfaceutil.implementer(repository.imanifestrevisionwritable) 2009 @interfaceutil.implementer(repository.imanifestrevisionwritable)
2010 class memmanifestctx(object): 2010 class memmanifestctx:
2011 def __init__(self, manifestlog): 2011 def __init__(self, manifestlog):
2012 self._manifestlog = manifestlog 2012 self._manifestlog = manifestlog
2013 self._manifestdict = manifestdict(manifestlog.nodeconstants.nodelen) 2013 self._manifestdict = manifestdict(manifestlog.nodeconstants.nodelen)
2014 2014
2015 def _storage(self): 2015 def _storage(self):
2035 match=match, 2035 match=match,
2036 ) 2036 )
2037 2037
2038 2038
2039 @interfaceutil.implementer(repository.imanifestrevisionstored) 2039 @interfaceutil.implementer(repository.imanifestrevisionstored)
2040 class manifestctx(object): 2040 class manifestctx:
2041 """A class representing a single revision of a manifest, including its 2041 """A class representing a single revision of a manifest, including its
2042 contents, its parent revs, and its linkrev. 2042 contents, its parent revs, and its linkrev.
2043 """ 2043 """
2044 2044
2045 def __init__(self, manifestlog, node): 2045 def __init__(self, manifestlog, node):
2115 def find(self, key): 2115 def find(self, key):
2116 return self.read().find(key) 2116 return self.read().find(key)
2117 2117
2118 2118
2119 @interfaceutil.implementer(repository.imanifestrevisionwritable) 2119 @interfaceutil.implementer(repository.imanifestrevisionwritable)
2120 class memtreemanifestctx(object): 2120 class memtreemanifestctx:
2121 def __init__(self, manifestlog, dir=b''): 2121 def __init__(self, manifestlog, dir=b''):
2122 self._manifestlog = manifestlog 2122 self._manifestlog = manifestlog
2123 self._dir = dir 2123 self._dir = dir
2124 self._treemanifest = treemanifest(manifestlog.nodeconstants) 2124 self._treemanifest = treemanifest(manifestlog.nodeconstants)
2125 2125
2150 match=match, 2150 match=match,
2151 ) 2151 )
2152 2152
2153 2153
2154 @interfaceutil.implementer(repository.imanifestrevisionstored) 2154 @interfaceutil.implementer(repository.imanifestrevisionstored)
2155 class treemanifestctx(object): 2155 class treemanifestctx:
2156 def __init__(self, manifestlog, dir, node): 2156 def __init__(self, manifestlog, dir, node):
2157 self._manifestlog = manifestlog 2157 self._manifestlog = manifestlog
2158 self._dir = dir 2158 self._dir = dir
2159 self._data = None 2159 self._data = None
2160 2160