comparison mercurial/localrepo.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 2cce2fa5bcf7
children a932cad26d37
comparison
equal deleted inserted replaced
48945:55d132525155 48946:642e31cb55f0
249 } 249 }
250 legacycaps = moderncaps.union({b'changegroupsubset'}) 250 legacycaps = moderncaps.union({b'changegroupsubset'})
251 251
252 252
253 @interfaceutil.implementer(repository.ipeercommandexecutor) 253 @interfaceutil.implementer(repository.ipeercommandexecutor)
254 class localcommandexecutor(object): 254 class localcommandexecutor:
255 def __init__(self, peer): 255 def __init__(self, peer):
256 self._peer = peer 256 self._peer = peer
257 self._sent = False 257 self._sent = False
258 self._closed = False 258 self._closed = False
259 259
1213 """Produce a type conforming to ``ilocalrepositorymain``.""" 1213 """Produce a type conforming to ``ilocalrepositorymain``."""
1214 return localrepository 1214 return localrepository
1215 1215
1216 1216
1217 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage) 1217 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
1218 class revlogfilestorage(object): 1218 class revlogfilestorage:
1219 """File storage when using revlogs.""" 1219 """File storage when using revlogs."""
1220 1220
1221 def file(self, path): 1221 def file(self, path):
1222 if path.startswith(b'/'): 1222 if path.startswith(b'/'):
1223 path = path[1:] 1223 path = path[1:]
1224 1224
1225 return filelog.filelog(self.svfs, path) 1225 return filelog.filelog(self.svfs, path)
1226 1226
1227 1227
1228 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage) 1228 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
1229 class revlognarrowfilestorage(object): 1229 class revlognarrowfilestorage:
1230 """File storage when using revlogs and narrow files.""" 1230 """File storage when using revlogs and narrow files."""
1231 1231
1232 def file(self, path): 1232 def file(self, path):
1233 if path.startswith(b'/'): 1233 if path.startswith(b'/'):
1234 path = path[1:] 1234 path = path[1:]
1257 (repository.ilocalrepositoryfilestorage, lambda: makefilestorage), 1257 (repository.ilocalrepositoryfilestorage, lambda: makefilestorage),
1258 ] 1258 ]
1259 1259
1260 1260
1261 @interfaceutil.implementer(repository.ilocalrepositorymain) 1261 @interfaceutil.implementer(repository.ilocalrepositorymain)
1262 class localrepository(object): 1262 class localrepository:
1263 """Main class for representing local repositories. 1263 """Main class for representing local repositories.
1264 1264
1265 All local repositories are instances of this class. 1265 All local repositories are instances of this class.
1266 1266
1267 Constructed on its own, instances of this class are not usable as 1267 Constructed on its own, instances of this class are not usable as
2042 """Returns a tagscache object that contains various tags related 2042 """Returns a tagscache object that contains various tags related
2043 caches.""" 2043 caches."""
2044 2044
2045 # This simplifies its cache management by having one decorated 2045 # This simplifies its cache management by having one decorated
2046 # function (this one) and the rest simply fetch things from it. 2046 # function (this one) and the rest simply fetch things from it.
2047 class tagscache(object): 2047 class tagscache:
2048 def __init__(self): 2048 def __init__(self):
2049 # These two define the set of tags for this repository. tags 2049 # These two define the set of tags for this repository. tags
2050 # maps tag name to node; tagtypes maps tag name to 'global' or 2050 # maps tag name to node; tagtypes maps tag name to 'global' or
2051 # 'local'. (Global tags are defined by .hgtags across all 2051 # 'local'. (Global tags are defined by .hgtags across all
2052 # heads, and local tags are defined in .hg/localtags.) 2052 # heads, and local tags are defined in .hg/localtags.)
3910 # Our strategy is to replace the type of the object with one that 3910 # Our strategy is to replace the type of the object with one that
3911 # has all attribute lookups result in error. 3911 # has all attribute lookups result in error.
3912 # 3912 #
3913 # But we have to allow the close() method because some constructors 3913 # But we have to allow the close() method because some constructors
3914 # of repos call close() on repo references. 3914 # of repos call close() on repo references.
3915 class poisonedrepository(object): 3915 class poisonedrepository:
3916 def __getattribute__(self, item): 3916 def __getattribute__(self, item):
3917 if item == 'close': 3917 if item == 'close':
3918 return object.__getattribute__(self, item) 3918 return object.__getattribute__(self, item)
3919 3919
3920 raise error.ProgrammingError( 3920 raise error.ProgrammingError(