equal
deleted
inserted
replaced
74 else: |
74 else: |
75 m = lines_re.match(line) |
75 m = lines_re.match(line) |
76 if m: |
76 if m: |
77 yield 'range', m.groups() |
77 yield 'range', m.groups() |
78 else: |
78 else: |
79 raise patch.PatchError('unknown patch content: %r' % line) |
79 yield 'other', line |
80 |
80 |
81 class header(object): |
81 class header(object): |
82 """patch header |
82 """patch header |
83 |
83 |
84 XXX shouldn't we move this to mercurial/patch.py ? |
84 XXX shouldn't we move this to mercurial/patch.py ? |
226 self.addcontext([]) |
226 self.addcontext([]) |
227 h = header(hdr) |
227 h = header(hdr) |
228 self.headers.append(h) |
228 self.headers.append(h) |
229 self.header = h |
229 self.header = h |
230 |
230 |
|
231 def addother(self, line): |
|
232 pass # 'other' lines are ignored |
|
233 |
231 def finished(self): |
234 def finished(self): |
232 self.addcontext([]) |
235 self.addcontext([]) |
233 return self.headers |
236 return self.headers |
234 |
237 |
235 transitions = { |
238 transitions = { |
237 'file': newfile, |
240 'file': newfile, |
238 'hunk': addhunk, |
241 'hunk': addhunk, |
239 'range': addrange}, |
242 'range': addrange}, |
240 'context': {'file': newfile, |
243 'context': {'file': newfile, |
241 'hunk': addhunk, |
244 'hunk': addhunk, |
242 'range': addrange}, |
245 'range': addrange, |
|
246 'other': addother}, |
243 'hunk': {'context': addcontext, |
247 'hunk': {'context': addcontext, |
244 'file': newfile, |
248 'file': newfile, |
245 'range': addrange}, |
249 'range': addrange}, |
246 'range': {'context': addcontext, |
250 'range': {'context': addcontext, |
247 'hunk': addhunk}, |
251 'hunk': addhunk}, |
|
252 'other': {'other': addother}, |
248 } |
253 } |
249 |
254 |
250 p = parser() |
255 p = parser() |
251 |
256 |
252 state = 'context' |
257 state = 'context' |