Mercurial > hg
comparison mercurial/patch.py @ 5143:d4fa6bafc43a
Remove trailing spaces, fix indentation
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Tue, 07 Aug 2007 10:28:43 +0200 |
parents | 35d47b06d4e3 |
children | 0fc16031bb45 |
comparison
equal
deleted
inserted
replaced
5142:2ffe3e2a1ac2 | 5143:d4fa6bafc43a |
---|---|
319 d = os.path.join(d, x) | 319 d = os.path.join(d, x) |
320 if not os.path.isdir(d): | 320 if not os.path.isdir(d): |
321 os.mkdir(d) | 321 os.mkdir(d) |
322 self.lines = [] | 322 self.lines = [] |
323 self.exists = False | 323 self.exists = False |
324 | 324 |
325 self.hash = {} | 325 self.hash = {} |
326 self.dirty = 0 | 326 self.dirty = 0 |
327 self.offset = 0 | 327 self.offset = 0 |
328 self.rej = [] | 328 self.rej = [] |
329 self.fileprinted = False | 329 self.fileprinted = False |
348 # from linenum | 348 # from linenum |
349 def sorter(a, b): | 349 def sorter(a, b): |
350 vala = abs(a - linenum) | 350 vala = abs(a - linenum) |
351 valb = abs(b - linenum) | 351 valb = abs(b - linenum) |
352 return cmp(vala, valb) | 352 return cmp(vala, valb) |
353 | 353 |
354 try: | 354 try: |
355 cand = self.hash[l] | 355 cand = self.hash[l] |
356 except: | 356 except: |
357 return [] | 357 return [] |
358 | 358 |
704 return l[top:len(l)-bot] | 704 return l[top:len(l)-bot] |
705 return l | 705 return l |
706 | 706 |
707 def old(self, fuzz=0, toponly=False): | 707 def old(self, fuzz=0, toponly=False): |
708 return self.fuzzit(self.a, fuzz, toponly) | 708 return self.fuzzit(self.a, fuzz, toponly) |
709 | 709 |
710 def newctrl(self): | 710 def newctrl(self): |
711 res = [] | 711 res = [] |
712 for x in self.hunk: | 712 for x in self.hunk: |
713 c = x[0] | 713 c = x[0] |
714 if c == ' ' or c == '+': | 714 if c == ' ' or c == '+': |
840 def applydiff(ui, fp, changed, strip=1, sourcefile=None, reverse=False, | 840 def applydiff(ui, fp, changed, strip=1, sourcefile=None, reverse=False, |
841 rejmerge=None, updatedir=None): | 841 rejmerge=None, updatedir=None): |
842 """reads a patch from fp and tries to apply it. The dict 'changed' is | 842 """reads a patch from fp and tries to apply it. The dict 'changed' is |
843 filled in with all of the filenames changed by the patch. Returns 0 | 843 filled in with all of the filenames changed by the patch. Returns 0 |
844 for a clean patch, -1 if any rejects were found and 1 if there was | 844 for a clean patch, -1 if any rejects were found and 1 if there was |
845 any fuzz.""" | 845 any fuzz.""" |
846 | 846 |
847 def scangitpatch(fp, firstline, cwd=None): | 847 def scangitpatch(fp, firstline, cwd=None): |
848 '''git patches can modify a file, then copy that file to | 848 '''git patches can modify a file, then copy that file to |
849 a new file, but expect the source to be the unmodified form. | 849 a new file, but expect the source to be the unmodified form. |
850 So we scan the patch looking for that case so we can do | 850 So we scan the patch looking for that case so we can do |