comparison mercurial/bundle2.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 f254fc73d956
children bde2e4ef968a
comparison
equal deleted inserted replaced
48945:55d132525155 48946:642e31cb55f0
249 return func 249 return func
250 250
251 return _decorator 251 return _decorator
252 252
253 253
254 class unbundlerecords(object): 254 class unbundlerecords:
255 """keep record of what happens during and unbundle 255 """keep record of what happens during and unbundle
256 256
257 New records are added using `records.add('cat', obj)`. Where 'cat' is a 257 New records are added using `records.add('cat', obj)`. Where 'cat' is a
258 category of record and obj is an arbitrary object. 258 category of record and obj is an arbitrary object.
259 259
297 return bool(self._sequences) 297 return bool(self._sequences)
298 298
299 __bool__ = __nonzero__ 299 __bool__ = __nonzero__
300 300
301 301
302 class bundleoperation(object): 302 class bundleoperation:
303 """an object that represents a single bundling process 303 """an object that represents a single bundling process
304 304
305 Its purpose is to carry unbundle-related objects and states. 305 Its purpose is to carry unbundle-related objects and states.
306 306
307 A new object should be created at the beginning of each bundle processing. 307 A new object should be created at the beginning of each bundle processing.
377 op = bundleoperation(repo, lambda: tr, source=source) 377 op = bundleoperation(repo, lambda: tr, source=source)
378 _processchangegroup(op, unbundler, tr, source, url, **kwargs) 378 _processchangegroup(op, unbundler, tr, source, url, **kwargs)
379 return op 379 return op
380 380
381 381
382 class partiterator(object): 382 class partiterator:
383 def __init__(self, repo, op, unbundler): 383 def __init__(self, repo, op, unbundler):
384 self.repo = repo 384 self.repo = repo
385 self.op = op 385 self.op = op
386 self.unbundler = unbundler 386 self.unbundler = unbundler
387 self.iterator = None 387 self.iterator = None
624 624
625 # hgweb uses this list to communicate its preferred type 625 # hgweb uses this list to communicate its preferred type
626 bundlepriority = [b'HG10GZ', b'HG10BZ', b'HG10UN'] 626 bundlepriority = [b'HG10GZ', b'HG10BZ', b'HG10UN']
627 627
628 628
629 class bundle20(object): 629 class bundle20:
630 """represent an outgoing bundle2 container 630 """represent an outgoing bundle2 container
631 631
632 Use the `addparam` method to add stream level parameter. and `newpart` to 632 Use the `addparam` method to add stream level parameter. and `newpart` to
633 populate it. Then call `getchunks` to retrieve all the binary chunks of 633 populate it. Then call `getchunks` to retrieve all the binary chunks of
634 data that compose the bundle2 container.""" 634 data that compose the bundle2 container."""
748 if part.type.startswith(b'output'): 748 if part.type.startswith(b'output'):
749 salvaged.append(part.copy()) 749 salvaged.append(part.copy())
750 return salvaged 750 return salvaged
751 751
752 752
753 class unpackermixin(object): 753 class unpackermixin:
754 """A mixin to extract bytes and struct data from a stream""" 754 """A mixin to extract bytes and struct data from a stream"""
755 755
756 def __init__(self, fp): 756 def __init__(self, fp):
757 self._fp = fp 757 self._fp = fp
758 758
981 unbundler._compengine = util.compengines.forbundletype(value) 981 unbundler._compengine = util.compengines.forbundletype(value)
982 if value is not None: 982 if value is not None:
983 unbundler._compressed = True 983 unbundler._compressed = True
984 984
985 985
986 class bundlepart(object): 986 class bundlepart:
987 """A bundle2 part contains application level payload 987 """A bundle2 part contains application level payload
988 988
989 The part `type` is used to route the part to the application level 989 The part `type` is used to route the part to the application level
990 handler. 990 handler.
991 991
1271 self.ui.debug( 1271 self.ui.debug(
1272 b'bundle2-input-stream-interrupt: closing out of band context\n' 1272 b'bundle2-input-stream-interrupt: closing out of band context\n'
1273 ) 1273 )
1274 1274
1275 1275
1276 class interruptoperation(object): 1276 class interruptoperation:
1277 """A limited operation to be use by part handler during interruption 1277 """A limited operation to be use by part handler during interruption
1278 1278
1279 It only have access to an ui object. 1279 It only have access to an ui object.
1280 """ 1280 """
1281 1281