comparison mercurial/patch.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children ca7bde5dbafb
comparison
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
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
232 # attempt to detect the start of a patch 233 # attempt to detect the start of a patch
233 # (this heuristic is borrowed from quilt) 234 # (this heuristic is borrowed from quilt)
234 diffre = re.compile( 235 diffre = re.compile(
235 br'^(?:Index:[ \t]|diff[ \t]-|RCS file: |' 236 br'^(?:Index:[ \t]|diff[ \t]-|RCS file: |'
236 br'retrieving revision [0-9]+(\.[0-9]+)*$|' 237 br'retrieving revision [0-9]+(\.[0-9]+)*$|'
593 self.opener = None 594 self.opener = None
594 self.files = {} 595 self.files = {}
595 self.created = 0 596 self.created = 0
596 self.maxsize = maxsize 597 self.maxsize = maxsize
597 if self.maxsize is None: 598 if self.maxsize is None:
598 self.maxsize = 4 * (2**20) 599 self.maxsize = 4 * (2 ** 20)
599 self.size = 0 600 self.size = 0
600 self.data = {} 601 self.data = {}
601 602
602 def setfile(self, fname, data, mode, copied=None): 603 def setfile(self, fname, data, mode, copied=None):
603 if self.maxsize < 0 or (len(data) + self.size) <= self.maxsize: 604 if self.maxsize < 0 or (len(data) + self.size) <= self.maxsize: