Commit b982af16 authored by Christophe Dumez's avatar Christophe Dumez

- fixed copytree function (couldn't create directories)

- renamed working copy preferences


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6791 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 53456eee
...@@ -207,7 +207,7 @@ try: ...@@ -207,7 +207,7 @@ try:
return self.aq_parent._getLogin(realm) return self.aq_parent._getLogin(realm)
def _getPreferences(self): def _getPreferences(self):
working_path = self.getPortalObject().portal_preferences.getPreference('subversion_working_copy') working_path = self.getPortalObject().portal_preferences.getPreferredSubversionWorkingCopy()
if not working_path : if not working_path :
raise "Error: Please set Subversion working path in preferences" raise "Error: Please set Subversion working path in preferences"
#self.svn_username = self.getPortalObject().portal_preferences.getPreference('preferred_subversion_user_name') #self.svn_username = self.getPortalObject().portal_preferences.getPreference('preferred_subversion_user_name')
......
...@@ -84,8 +84,6 @@ def copytree(src, dst, symlinks=False): ...@@ -84,8 +84,6 @@ def copytree(src, dst, symlinks=False):
it is false, the contents of the files pointed to by symbolic it is false, the contents of the files pointed to by symbolic
links are copied. links are copied.
""" """
if not os.path.exists(dst):
os.mkdir(dst)
names = os.listdir(src) names = os.listdir(src)
errors = [] errors = []
for name in names: for name in names:
...@@ -96,6 +94,8 @@ def copytree(src, dst, symlinks=False): ...@@ -96,6 +94,8 @@ def copytree(src, dst, symlinks=False):
linkto = os.readlink(srcname) linkto = os.readlink(srcname)
os.symlink(linkto, dstname) os.symlink(linkto, dstname)
elif os.path.isdir(srcname): elif os.path.isdir(srcname):
if not os.path.exists(dstname):
os.makedirs(dstname)
copytree(srcname, dstname, symlinks) copytree(srcname, dstname, symlinks)
else: else:
copy(srcname, dstname) copy(srcname, dstname)
...@@ -448,7 +448,7 @@ class SubversionTool(UniqueObject, Folder): ...@@ -448,7 +448,7 @@ class SubversionTool(UniqueObject, Folder):
# if file have been deleted then not in zodb # if file have been deleted then not in zodb
if not os.path.exists(path): if not os.path.exists(path):
return '#' return '#'
svn_path = bt.getPortalObject().portal_preferences.getPreference('subversion_working_copy') svn_path = bt.getPortalObject().portal_preferences.getPreferredSubversionWorkingCopy()
if not svn_path: if not svn_path:
raise 'Error: Please set working copy path in Subversion preferences !' raise 'Error: Please set working copy path in Subversion preferences !'
svn_path = os.path.join(svn_path, bt.getTitle()) svn_path = os.path.join(svn_path, bt.getTitle())
...@@ -606,7 +606,7 @@ class SubversionTool(UniqueObject, Folder): ...@@ -606,7 +606,7 @@ class SubversionTool(UniqueObject, Folder):
def info(self): def info(self):
"""return info of working copy """return info of working copy
""" """
working_copy = self.getPortalObject().portal_preferences.getPreference('subversion_working_copy') working_copy = self.getPortalObject().portal_preferences.getPreferredSubversionWorkingCopy()
if not working_copy : if not working_copy :
raise 'Please set Working copy path in preferences' raise 'Please set Working copy path in preferences'
client = self._getClient() client = self._getClient()
...@@ -623,7 +623,7 @@ class SubversionTool(UniqueObject, Folder): ...@@ -623,7 +623,7 @@ class SubversionTool(UniqueObject, Folder):
def cleanup(self): def cleanup(self):
"""remove svn locks in working copy """remove svn locks in working copy
""" """
working_copy = self.getPortalObject().portal_preferences.getPreference('subversion_working_copy') working_copy = self.getPortalObject().portal_preferences.getPreferredSubversionWorkingCopy()
if not working_copy : if not working_copy :
raise 'Please set Working copy path in preferences' raise 'Please set Working copy path in preferences'
client = self._getClient() client = self._getClient()
...@@ -680,7 +680,7 @@ class SubversionTool(UniqueObject, Folder): ...@@ -680,7 +680,7 @@ class SubversionTool(UniqueObject, Folder):
def getModifiedTree(self, path) : def getModifiedTree(self, path) :
# Remove trailing slash if it's present # Remove trailing slash if it's present
if path[-1]== os.sep : if path[-1] == os.sep :
path = path[:-1] path = path[:-1]
root = Dir(path, "normal") root = Dir(path, "normal")
...@@ -724,7 +724,7 @@ class SubversionTool(UniqueObject, Folder): ...@@ -724,7 +724,7 @@ class SubversionTool(UniqueObject, Folder):
def extractBT(self, bt): def extractBT(self, bt):
path = mktemp() path = mktemp()
bt.export(path=path, local=1) bt.export(path=path, local=1)
svn_path = self.getPortalObject().portal_preferences.getPreference('subversion_working_copy') svn_path = self.getPortalObject().portal_preferences.getPreferredSubversionWorkingCopy()
if not svn_path : if not svn_path :
raise "Error: Please set Subversion working path in preferences" raise "Error: Please set Subversion working path in preferences"
svn_path=os.path.join(svn_path,bt.getTitle())+os.sep svn_path=os.path.join(svn_path,bt.getTitle())+os.sep
...@@ -792,7 +792,7 @@ class SubversionTool(UniqueObject, Folder): ...@@ -792,7 +792,7 @@ class SubversionTool(UniqueObject, Folder):
def _treeToXML(self, item, output, ident, first) : def _treeToXML(self, item, output, ident, first) :
# svn path # svn path
svn_path = self.getPortalObject().portal_preferences.getPreference('subversion_working_copy') svn_path = self.getPortalObject().portal_preferences.getPreferredSubversionWorkingCopy()
if not svn_path : if not svn_path :
raise "Error: Please set Subversion working path in preferences" raise "Error: Please set Subversion working path in preferences"
if svn_path[-1] != os.sep: if svn_path[-1] != os.sep:
......
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