24 |
24 |
25 import Utilities |
25 import Utilities |
26 import Preferences |
26 import Preferences |
27 |
27 |
28 from difflib import SequenceMatcher |
28 from difflib import SequenceMatcher |
29 |
|
30 # This function is copied from python 2.3 and slightly modified. |
|
31 # The header lines contain a tab after the filename. |
|
32 |
29 |
33 |
30 |
34 def unified_diff(a, b, fromfile='', tofile='', fromfiledate='', |
31 def unified_diff(a, b, fromfile='', tofile='', fromfiledate='', |
35 tofiledate='', n=3, lineterm='\n'): |
32 tofiledate='', n=3, lineterm='\n'): |
36 """ |
33 """ |
104 for line in a[i1:i2]: |
101 for line in a[i1:i2]: |
105 yield '-' + line |
102 yield '-' + line |
106 if tag == 'replace' or tag == 'insert': |
103 if tag == 'replace' or tag == 'insert': |
107 for line in b[j1:j2]: |
104 for line in b[j1:j2]: |
108 yield '+' + line |
105 yield '+' + line |
109 |
|
110 # This function is copied from python 2.3 and slightly modified. |
|
111 # The header lines contain a tab after the filename. |
|
112 |
106 |
113 |
107 |
114 def context_diff(a, b, fromfile='', tofile='', |
108 def context_diff(a, b, fromfile='', tofile='', |
115 fromfiledate='', tofiledate='', n=3, lineterm='\n'): |
109 fromfiledate='', tofiledate='', n=3, lineterm='\n'): |
116 r""" |
110 r""" |