##// 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 566 return self.changed | self.removed
567 567
568 568 # @@ -start,len +start,len @@ or @@ -start +start @@ if len is 1
569 unidesc = re.compile('@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@')
570 contextdesc = re.compile('(---|\*\*\*) (\d+)(,(\d+))? (---|\*\*\*)')
569 unidesc = re.compile('@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@')
570 contextdesc = re.compile('(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)')
571 571 eolmodes = ['strict', 'crlf', 'lf', 'auto']
572 572
573 573 class patchfile(object):
@@ -830,7 +830,7 b' class hunk(object):'
830 830 m = unidesc.match(self.desc)
831 831 if not m:
832 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 834 if self.lena is None:
835 835 self.lena = 1
836 836 else:
@@ -857,7 +857,7 b' class hunk(object):'
857 857 m = contextdesc.match(self.desc)
858 858 if not m:
859 859 raise PatchError(_("bad hunk #%d") % self.number)
860 foo, self.starta, foo2, aend, foo3 = m.groups()
860 self.starta, aend = m.groups()
861 861 self.starta = int(self.starta)
862 862 if aend is None:
863 863 aend = self.starta
@@ -890,7 +890,7 b' class hunk(object):'
890 890 m = contextdesc.match(l)
891 891 if not m:
892 892 raise PatchError(_("bad hunk #%d") % self.number)
893 foo, self.startb, foo2, bend, foo3 = m.groups()
893 self.startb, bend = m.groups()
894 894 self.startb = int(self.startb)
895 895 if bend is None:
896 896 bend = self.startb
General Comments 0
You need to be logged in to leave comments. Login now