[Erp5-report] r32334 rafael - /erp5/trunk/products/ERP5Type/DiffUtils.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Feb 8 22:20:24 CET 2010
Author: rafael
Date: Mon Feb 8 22:20:24 2010
New Revision: 32334
URL: http://svn.erp5.org?rev=32334&view=rev
Log:
Make it a bit more flexible to be able to handle output diffs from BusinessTemplate.diffObject().
Modified:
erp5/trunk/products/ERP5Type/DiffUtils.py
Modified: erp5/trunk/products/ERP5Type/DiffUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/DiffUtils.py?rev=32334&r1=32333&r2=32334&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/DiffUtils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/DiffUtils.py [utf8] Mon Feb 8 22:20:24 2010
@@ -65,12 +65,20 @@
for line in self.header.splitlines():
if line.startswith('--- '):
tmp = re.search('\\([^)]+\\)$', line)
- self.old_revision = tmp.string[tmp.start():tmp.end()][1:-1].strip()
+ if tmp is not None:
+ self.old_revision = tmp.string[tmp.start():tmp.end()][1:-1].strip()
+ else:
+ self.old_revision = line.replace("--- ", "")
if line.startswith('+++ '):
tmp = re.search('\\([^)]+\\)$', line)
- self.new_revision = tmp.string[tmp.start():tmp.end()][1:-1].strip()
+ if tmp is not None:
+ self.new_revision = tmp.string[tmp.start():tmp.end()][1:-1].strip()
+ else:
+ self.new_revision = line.replace("+++ ", "")
# Splitting the body from the header
- self.body = os.linesep.join(raw_diff.strip().splitlines()[4:])
+ 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:])
# Now splitting modifications
self.children = []
first = True
@@ -84,7 +92,7 @@
first = False
tmp.append(line)
self.children.append(CodeBlock(os.linesep.join(tmp)))
-
+
def toHTML(self):
""" return HTML diff
"""
More information about the Erp5-report
mailing list