mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- adapt old difflib format to python2.7's format
This commit is contained in:
parent
044c678455
commit
7fb1d22593
@ -3488,9 +3488,13 @@ def get_source_file_diff(dir, filename, rev, oldfilename = None, olddir = None,
|
||||
d = difflib.unified_diff(s1, s2,
|
||||
fromfile = '%s\t(revision %s)' % (origfilename, rev), \
|
||||
tofile = '%s\t(working copy)' % origfilename)
|
||||
d = list(d)
|
||||
# python2.7's difflib slightly changed the format
|
||||
# adapt old format to the new format
|
||||
d[0] = d[0].replace(' \n', '\n')
|
||||
d[1] = d[1].replace(' \n', '\n')
|
||||
|
||||
# if file doesn't end with newline, we need to append one in the diff result
|
||||
d = list(d)
|
||||
for i, line in enumerate(d):
|
||||
if not line.endswith('\n'):
|
||||
d[i] += '\n\\ No newline at end of file'
|
||||
|
Loading…
Reference in New Issue
Block a user