Mercurial > hg
changeset 13700:63307feb59dd
patch: inline patchfile.hashlines()
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 20 Mar 2011 00:09:44 +0100 |
parents | d3c0e0033f13 |
children | bc38ff7cb919 |
files | mercurial/patch.py |
diffstat | 1 files changed, 4 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/patch.py Sun Mar 20 00:08:44 2011 +0100 +++ b/mercurial/patch.py Sun Mar 20 00:09:44 2011 +0100 @@ -488,11 +488,6 @@ cand.sort(key=lambda x: abs(x - linenum)) return cand - def hashlines(self): - self.hash = {} - for x, s in enumerate(self.lines): - self.hash.setdefault(s, []).append(x) - def makerejlines(self, fname): base = os.path.basename(fname) yield "--- %s\n+++ %s\n" % (base, base) @@ -574,8 +569,10 @@ self.dirty = 1 return 0 - # ok, we couldn't match the hunk. Lets look for offsets and fuzz it - self.hashlines() + # ok, we couldn't match the hunk. Lets look for offsets and fuzz it + self.hash = {} + for x, s in enumerate(self.lines): + self.hash.setdefault(s, []).append(x) if h.hunk[-1][0] != ' ': # if the hunk tried to put something at the bottom of the file # override the start line and use eof here