Commit bfcc93f7 authored by Christophe Dumez's avatar Christophe Dumez

- Fixed a bug when commiting file removals (happened in some cases)

- Started work on revert but not working yet


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6988 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1d2583a0
......@@ -84,7 +84,7 @@ else:\n
if commit_non_recurs != \'\' and commit_non_recurs != \'none\':\n
commit_non_recurs = commit_non_recurs.split(\',\')\n
if removed != \'\' and removed != \'none\':\n
commit_recurs = removed.split(\',\')\n
commit_recurs = context.getPortalObject()["portal_subversion"].cleanChildrenInList(removed.split(\',\'))\n
else:\n
commit_recurs = removed\n
\n
......
......@@ -69,7 +69,8 @@
<value> <string>if files != \'none\' and files !=\'\':\n
to_revert = files.split(\',\')\n
else:\n
to_revert = files\n
context.REQUEST.set(\'portal_status_message\', \'Nothing to revert.\')\n
return context.BusinessTemplate_viewSvnStatus()\n
\n
if to_revert != \'none\' and to_revert != \'\':\n
context.getPortalObject()["portal_subversion"].revert(path=to_revert, bt=context)\n
......@@ -119,8 +120,8 @@ return context.BusinessTemplate_viewSvnStatus()\n
<string>files</string>
<string>_getattr_</string>
<string>to_revert</string>
<string>_getitem_</string>
<string>context</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
......
......@@ -722,15 +722,25 @@ class SubversionTool(UniqueObject, Folder):
if bt is not None:
object_to_update = {}
if isinstance(path, list) :
for p in path:
path_list = p.split(os.sep)
if 'bt' not in path_list:
if len(path_list) > 2 :
tmp=os.sep.join(path_list[2:])
object_to_update[tmp] = 'install'
#raise str(object_to_update)
path = [self.relativeToAbsolute(x, bt) for x in path]
#for p in path:
#object_to_update[p.split(os.sep)[-1]] = 'install'
else:
path_list = path.split(os.sep)
if 'bt' not in path_list:
if len(path_list) > 2 :
tmp=os.sep.join(path_list[2:])
object_to_update[tmp] = 'install'
path = self.relativeToAbsolute(path, bt)
#object_to_update[path.split(os.sep)[-1]] = 'install'
#else:
#bt.install(object_to_update=object_to_update)
client.revert(path, recurse)
if bt is not None:
installed_bt = bt.portal_templates.getInstalledBusinessTemplate( bt.getTitle())
installed_bt.install(object_to_update=object_to_update, force=0)
security.declareProtected('Import/Export objects', 'resolved')
# path can be absolute or relative
......@@ -863,6 +873,14 @@ class SubversionTool(UniqueObject, Folder):
def importBT(self, bt):
return bt.download(self.getSubversionPath(bt))
# Get a list of files and keep only parents
# Necessary before recursively commit removals
def cleanChildrenInList(self, list):
res = list
for file in list:
res = [x for x in res if file == x or file not in x]
return res
# return a set with directories present in the directory
def getSetDirsForDir(self, directory):
......
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