comparison mercurial/patch.py @ 51699:ca7bde5dbafb

black: format the codebase with 23.3.0 The CI has moved to 23.3.0, which is the last version that supports 3.7 at runtime, so we should honor this change. # skip-blame mass-reformating only
author Rapha?l Gom?s <rgomes@octobus.net>
date Thu, 18 Jul 2024 12:36:12 +0200
parents 7f0cb9ee0534
children 454feddab720
comparison
equal deleted inserted replaced
51698:b0a4de6c14f8 51699:ca7bde5dbafb
227 tmpfp.close() 227 tmpfp.close()
228 os.unlink(tmpname) 228 os.unlink(tmpname)
229 229
230 230
231 def _extract(ui, fileobj, tmpname, tmpfp): 231 def _extract(ui, fileobj, tmpname, tmpfp):
232
233 # attempt to detect the start of a patch 232 # attempt to detect the start of a patch
234 # (this heuristic is borrowed from quilt) 233 # (this heuristic is borrowed from quilt)
235 diffre = re.compile( 234 diffre = re.compile(
236 br'^(?:Index:[ \t]|diff[ \t]-|RCS file: |' 235 br'^(?:Index:[ \t]|diff[ \t]-|RCS file: |'
237 br'retrieving revision [0-9]+(\.[0-9]+)*$|' 236 br'retrieving revision [0-9]+(\.[0-9]+)*$|'
594 self.opener = None 593 self.opener = None
595 self.files = {} 594 self.files = {}
596 self.created = 0 595 self.created = 0
597 self.maxsize = maxsize 596 self.maxsize = maxsize
598 if self.maxsize is None: 597 if self.maxsize is None:
599 self.maxsize = 4 * (2 ** 20) 598 self.maxsize = 4 * (2**20)
600 self.size = 0 599 self.size = 0
601 self.data = {} 600 self.data = {}
602 601
603 def setfile(self, fname, data, mode, copied=None): 602 def setfile(self, fname, data, mode, copied=None):
604 if self.maxsize < 0 or (len(data) + self.size) <= self.maxsize: 603 if self.maxsize < 0 or (len(data) + self.size) <= self.maxsize: