Commit 41178d37 authored by Aurel's avatar Aurel

add diff for document, property sheet, extension, and test


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4350 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 014dba6a
...@@ -362,6 +362,7 @@ class TemplateTool (BaseTool): ...@@ -362,6 +362,7 @@ class TemplateTool (BaseTool):
bt2.edit(description='tmp bt generated for diff') bt2.edit(description='tmp bt generated for diff')
# separate item because somes are exported with zope exportXML and other with our own method # separate item because somes are exported with zope exportXML and other with our own method
# and others are just python code on filesystem
diff_msg = 'Diff between %s-%s and %s-%s' %(bt1.getTitle(), bt1.getId(), bt2.getTitle(), bt2.getId()) diff_msg = 'Diff between %s-%s and %s-%s' %(bt1.getTitle(), bt1.getId(), bt2.getTitle(), bt2.getId())
# for the one with zope exportXml # for the one with zope exportXml
item_list_1 = ['_product_item', '_workflow_item', '_portal_type_item', '_category_item', '_path_item', '_skin_item', '_action_item'] item_list_1 = ['_product_item', '_workflow_item', '_portal_type_item', '_category_item', '_path_item', '_skin_item', '_action_item']
...@@ -407,6 +408,25 @@ class TemplateTool (BaseTool): ...@@ -407,6 +408,25 @@ class TemplateTool (BaseTool):
if len(diff_list) != 0: if len(diff_list) != 0:
diff_msg += '\n\nObject %s diff :\n' %(key) diff_msg += '\n\nObject %s diff :\n' %(key)
diff_msg += '\n'.join(diff_list) diff_msg += '\n'.join(diff_list)
# for document located on filesystem
item_list_3 = ['_document_item', '_property_sheet_item', '_extension_item', '_test_item']
for item_name in item_list_3:
item1 = getattr(bt1, item_name)
# build current item if we compare to installed bt
if compare_to_installed:
getattr(bt2, item_name).build(bt2)
item2 = getattr(bt2, item_name)
for key in item1._objects.keys():
if item2._objects.has_key(key):
obj1_code = item1._objects[key]
obj2_code = item2._objects[key]
ob1_lines = obj1_code.splitlines()
ob2_lines = obj2_code.splitlines()
diff_list = list(unified_diff(ob1_lines, ob2_lines, fromfile=bt1.getId(), tofile=bt2.getId(), lineterm=''))
if len(diff_list) != 0:
diff_msg += '\n\nObject %s diff :\n' %(key)
diff_msg += '\n'.join(diff_list)
if compare_to_installed: if compare_to_installed:
self.manage_delObjects(ids=['installed_bt']) self.manage_delObjects(ids=['installed_bt'])
......
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