Commit 851eb882 authored by Christophe Dumez's avatar Christophe Dumez

- Finished revert implementation (should work now)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7061 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d461fff2
......@@ -45,6 +45,7 @@ from cStringIO import StringIO
from tempfile import mktemp
from shutil import copy
from zLOG import LOG
from Products.CMFCore.utils import getToolByName
try:
......@@ -757,7 +758,7 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
extension = tmp2.string[tmp2.start():tmp2.end()].strip()
tmp=tmp[:-len(extension)]
object_to_update[tmp] = 'install'
path_added_list = []
# remove added files
for p in added_files :
path_list = p.split(os.sep)
......@@ -769,8 +770,20 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
if tmp2:
extension = tmp2.string[tmp2.start():tmp2.end()].strip()
tmp=tmp[:-len(extension)]
object_to_update[tmp] = 'remove'
path_added_list.append(tmp)
## hack to remove objects
# Create a temporary bt with objects to delete
tmp_bt = getToolByName(bt, 'portal_templates').newContent(portal_type="Business Template")
tmp_bt.setTemplatePathList(path_added_list)
tmp_bt.setTitle('tmp_bt_revert')
# Build bt
tmp_bt.edit()
tmp_bt.build()
# Install then uninstall it to remove objects from ZODB
tmp_bt.install()
tmp_bt.uninstall()
# Remove it from portal template
bt.portal_templates.manage_delObjects(ids=tmp_bt.getId())
#revert changes
added_files.extend(other_files)
to_revert = [self.relativeToAbsolute(x, bt) for x in added_files]
......
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