Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 14217:71d5287351e9
patchfile: use real Booleans instead of 0/1
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Fri, 06 May 2011 11:12:55 +0200 |
parents | 19a7b48446e3 |
children | 202ff575d49b |
comparison
equal
deleted
inserted
replaced
14216:e3da95f84bcd | 14217:71d5287351e9 |
---|---|
404 pass | 404 pass |
405 else: | 405 else: |
406 self.ui.warn(_("unable to find '%s' for patching\n") % self.fname) | 406 self.ui.warn(_("unable to find '%s' for patching\n") % self.fname) |
407 | 407 |
408 self.hash = {} | 408 self.hash = {} |
409 self.dirty = 0 | 409 self.dirty = False |
410 self.offset = 0 | 410 self.offset = 0 |
411 self.skew = 0 | 411 self.skew = 0 |
412 self.rej = [] | 412 self.rej = [] |
413 self.fileprinted = False | 413 self.fileprinted = False |
414 self.printfile(False) | 414 self.printfile(False) |
537 if h.rmfile(): | 537 if h.rmfile(): |
538 self.unlink(self.fname) | 538 self.unlink(self.fname) |
539 else: | 539 else: |
540 self.lines[:] = h.new() | 540 self.lines[:] = h.new() |
541 self.offset += len(h.new()) | 541 self.offset += len(h.new()) |
542 self.dirty = 1 | 542 self.dirty = True |
543 return 0 | 543 return 0 |
544 | 544 |
545 horig = h | 545 horig = h |
546 if (self.eolmode in ('crlf', 'lf') | 546 if (self.eolmode in ('crlf', 'lf') |
547 or self.eolmode == 'auto' and self.eol): | 547 or self.eolmode == 'auto' and self.eol): |
565 if h.rmfile(): | 565 if h.rmfile(): |
566 self.unlink(self.fname) | 566 self.unlink(self.fname) |
567 else: | 567 else: |
568 self.lines[start : start + h.lena] = h.new() | 568 self.lines[start : start + h.lena] = h.new() |
569 self.offset += h.lenb - h.lena | 569 self.offset += h.lenb - h.lena |
570 self.dirty = 1 | 570 self.dirty = True |
571 return 0 | 571 return 0 |
572 | 572 |
573 # ok, we couldn't match the hunk. Lets look for offsets and fuzz it | 573 # ok, we couldn't match the hunk. Lets look for offsets and fuzz it |
574 self.hash = {} | 574 self.hash = {} |
575 for x, s in enumerate(self.lines): | 575 for x, s in enumerate(self.lines): |
590 if diffhelpers.testhunk(old, self.lines, l) == 0: | 590 if diffhelpers.testhunk(old, self.lines, l) == 0: |
591 newlines = h.new(fuzzlen, toponly) | 591 newlines = h.new(fuzzlen, toponly) |
592 self.lines[l : l + len(old)] = newlines | 592 self.lines[l : l + len(old)] = newlines |
593 self.offset += len(newlines) - len(old) | 593 self.offset += len(newlines) - len(old) |
594 self.skew = l - orig_start | 594 self.skew = l - orig_start |
595 self.dirty = 1 | 595 self.dirty = True |
596 offset = l - orig_start - fuzzlen | 596 offset = l - orig_start - fuzzlen |
597 if fuzzlen: | 597 if fuzzlen: |
598 msg = _("Hunk #%d succeeded at %d " | 598 msg = _("Hunk #%d succeeded at %d " |
599 "with fuzz %d " | 599 "with fuzz %d " |
600 "(offset %d lines).\n") | 600 "(offset %d lines).\n") |