comparison mercurial/scmutil.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 06de08b36c82
children 63fd0282ad40
comparison
equal deleted inserted replaced
48945:55d132525155 48946:642e31cb55f0
60 60
61 termsize = scmplatform.termsize 61 termsize = scmplatform.termsize
62 62
63 63
64 @attr.s(slots=True, repr=False) 64 @attr.s(slots=True, repr=False)
65 class status(object): 65 class status:
66 """Struct with a list of files per status. 66 """Struct with a list of files per status.
67 67
68 The 'deleted', 'unknown' and 'ignored' properties are only 68 The 'deleted', 'unknown' and 'ignored' properties are only
69 relevant to the working copy. 69 relevant to the working copy.
70 """ 70 """
321 _(b"ui.portablefilenames value is invalid ('%s')") % val 321 _(b"ui.portablefilenames value is invalid ('%s')") % val
322 ) 322 )
323 return abort, warn 323 return abort, warn
324 324
325 325
326 class casecollisionauditor(object): 326 class casecollisionauditor:
327 def __init__(self, ui, abort, dirstate): 327 def __init__(self, ui, abort, dirstate):
328 self._ui = ui 328 self._ui = ui
329 self._abort = abort 329 self._abort = abort
330 allfiles = b'\0'.join(dirstate) 330 allfiles = b'\0'.join(dirstate)
331 self._loweredfiles = set(encoding.lower(allfiles).split(b'\0')) 331 self._loweredfiles = set(encoding.lower(allfiles).split(b'\0'))
1017 origvfs.rmtree(filepath, forcibly=True) 1017 origvfs.rmtree(filepath, forcibly=True)
1018 1018
1019 return origvfs.join(filepath) 1019 return origvfs.join(filepath)
1020 1020
1021 1021
1022 class _containsnode(object): 1022 class _containsnode:
1023 """proxy __contains__(node) to container.__contains__ which accepts revs""" 1023 """proxy __contains__(node) to container.__contains__ which accepts revs"""
1024 1024
1025 def __init__(self, repo, revcontainer): 1025 def __init__(self, repo, revcontainer):
1026 self._torev = repo.changelog.rev 1026 self._torev = repo.changelog.rev
1027 self._revcontains = revcontainer.__contains__ 1027 self._revcontains = revcontainer.__contains__
1565 with opener(b'requires', b'w', atomictemp=True) as fp: 1565 with opener(b'requires', b'w', atomictemp=True) as fp:
1566 for r in sorted(requirements): 1566 for r in sorted(requirements):
1567 fp.write(b"%s\n" % r) 1567 fp.write(b"%s\n" % r)
1568 1568
1569 1569
1570 class filecachesubentry(object): 1570 class filecachesubentry:
1571 def __init__(self, path, stat): 1571 def __init__(self, path, stat):
1572 self.path = path 1572 self.path = path
1573 self.cachestat = None 1573 self.cachestat = None
1574 self._cacheable = None 1574 self._cacheable = None
1575 1575
1621 except OSError as e: 1621 except OSError as e:
1622 if e.errno != errno.ENOENT: 1622 if e.errno != errno.ENOENT:
1623 raise 1623 raise
1624 1624
1625 1625
1626 class filecacheentry(object): 1626 class filecacheentry:
1627 def __init__(self, paths, stat=True): 1627 def __init__(self, paths, stat=True):
1628 self._entries = [] 1628 self._entries = []
1629 for path in paths: 1629 for path in paths:
1630 self._entries.append(filecachesubentry(path, stat)) 1630 self._entries.append(filecachesubentry(path, stat))
1631 1631
1639 def refresh(self): 1639 def refresh(self):
1640 for entry in self._entries: 1640 for entry in self._entries:
1641 entry.refresh() 1641 entry.refresh()
1642 1642
1643 1643
1644 class filecache(object): 1644 class filecache:
1645 """A property like decorator that tracks files under .hg/ for updates. 1645 """A property like decorator that tracks files under .hg/ for updates.
1646 1646
1647 On first access, the files defined as arguments are stat()ed and the 1647 On first access, the files defined as arguments are stat()ed and the
1648 results cached. The decorated function is called. The results are stashed 1648 results cached. The decorated function is called. The results are stashed
1649 away in a ``_filecache`` dict on the object whose method is decorated. 1649 away in a ``_filecache`` dict on the object whose method is decorated.
1796 ) 1796 )
1797 1797
1798 return data 1798 return data
1799 1799
1800 1800
1801 class progress(object): 1801 class progress:
1802 def __init__(self, ui, updatebar, topic, unit=b"", total=None): 1802 def __init__(self, ui, updatebar, topic, unit=b"", total=None):
1803 self.ui = ui 1803 self.ui = ui
1804 self.pos = 0 1804 self.pos = 0
1805 self.topic = topic 1805 self.topic = topic
1806 self.unit = unit 1806 self.unit = unit
1861 """helper function to know if incoming delta should be optimised""" 1861 """helper function to know if incoming delta should be optimised"""
1862 # experimental config: format.generaldelta 1862 # experimental config: format.generaldelta
1863 return ui.configbool(b'format', b'generaldelta') 1863 return ui.configbool(b'format', b'generaldelta')
1864 1864
1865 1865
1866 class simplekeyvaluefile(object): 1866 class simplekeyvaluefile:
1867 """A simple file with key=value lines 1867 """A simple file with key=value lines
1868 1868
1869 Keys must be alphanumerics and start with a letter, values must not 1869 Keys must be alphanumerics and start with a letter, values must not
1870 contain '\n' characters""" 1870 contain '\n' characters"""
1871 1871