##// END OF EJS Templates
patch: simplify hunk extents parsing...
Patrick Mezard -
r15510:5414b56c default
parent child Browse files
Show More
@@ -566,8 +566,8 b' class repobackend(abstractbackend):'
566 return self.changed | self.removed
566 return self.changed | self.removed
567
567
568 # @@ -start,len +start,len @@ or @@ -start +start @@ if len is 1
568 # @@ -start,len +start,len @@ or @@ -start +start @@ if len is 1
569 unidesc = re.compile('@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@')
569 unidesc = re.compile('@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@')
570 contextdesc = re.compile('(---|\*\*\*) (\d+)(,(\d+))? (---|\*\*\*)')
570 contextdesc = re.compile('(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)')
571 eolmodes = ['strict', 'crlf', 'lf', 'auto']
571 eolmodes = ['strict', 'crlf', 'lf', 'auto']
572
572
573 class patchfile(object):
573 class patchfile(object):
@@ -830,7 +830,7 b' class hunk(object):'
830 m = unidesc.match(self.desc)
830 m = unidesc.match(self.desc)
831 if not m:
831 if not m:
832 raise PatchError(_("bad hunk #%d") % self.number)
832 raise PatchError(_("bad hunk #%d") % self.number)
833 self.starta, foo, self.lena, self.startb, foo2, self.lenb = m.groups()
833 self.starta, self.lena, self.startb, self.lenb = m.groups()
834 if self.lena is None:
834 if self.lena is None:
835 self.lena = 1
835 self.lena = 1
836 else:
836 else:
@@ -857,7 +857,7 b' class hunk(object):'
857 m = contextdesc.match(self.desc)
857 m = contextdesc.match(self.desc)
858 if not m:
858 if not m:
859 raise PatchError(_("bad hunk #%d") % self.number)
859 raise PatchError(_("bad hunk #%d") % self.number)
860 foo, self.starta, foo2, aend, foo3 = m.groups()
860 self.starta, aend = m.groups()
861 self.starta = int(self.starta)
861 self.starta = int(self.starta)
862 if aend is None:
862 if aend is None:
863 aend = self.starta
863 aend = self.starta
@@ -890,7 +890,7 b' class hunk(object):'
890 m = contextdesc.match(l)
890 m = contextdesc.match(l)
891 if not m:
891 if not m:
892 raise PatchError(_("bad hunk #%d") % self.number)
892 raise PatchError(_("bad hunk #%d") % self.number)
893 foo, self.startb, foo2, bend, foo3 = m.groups()
893 self.startb, bend = m.groups()
894 self.startb = int(self.startb)
894 self.startb = int(self.startb)
895 if bend is None:
895 if bend is None:
896 bend = self.startb
896 bend = self.startb
General Comments 0
You need to be logged in to leave comments. Login now