Commit 5053ae36 authored by Rafael Monnerat's avatar Rafael Monnerat

Make it a bit more flexible to be able to handle output diffs from BusinessTemplate.diffObject().

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32334 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 63797b1e
...@@ -65,11 +65,19 @@ class DiffFile: ...@@ -65,11 +65,19 @@ class DiffFile:
for line in self.header.splitlines(): for line in self.header.splitlines():
if line.startswith('--- '): if line.startswith('--- '):
tmp = re.search('\\([^)]+\\)$', line) tmp = re.search('\\([^)]+\\)$', line)
if tmp is not None:
self.old_revision = tmp.string[tmp.start():tmp.end()][1:-1].strip() self.old_revision = tmp.string[tmp.start():tmp.end()][1:-1].strip()
else:
self.old_revision = line.replace("--- ", "")
if line.startswith('+++ '): if line.startswith('+++ '):
tmp = re.search('\\([^)]+\\)$', line) tmp = re.search('\\([^)]+\\)$', line)
if tmp is not None:
self.new_revision = tmp.string[tmp.start():tmp.end()][1:-1].strip() self.new_revision = tmp.string[tmp.start():tmp.end()][1:-1].strip()
else:
self.new_revision = line.replace("+++ ", "")
# Splitting the body from the header # Splitting the body from the header
self.body = os.linesep.join(raw_diff.strip().splitlines()[3:])
if not self.body.startswith('@@'):
self.body = os.linesep.join(raw_diff.strip().splitlines()[4:]) self.body = os.linesep.join(raw_diff.strip().splitlines()[4:])
# Now splitting modifications # Now splitting modifications
self.children = [] self.children = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment