Commit b70d10a5 authored by Christophe Dumez's avatar Christophe Dumez

- improved debug output in copytree function

- sort list before svn add/del because order is important


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6801 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e989e4a5
...@@ -101,7 +101,7 @@ def copytree(src, dst, symlinks=False): ...@@ -101,7 +101,7 @@ def copytree(src, dst, symlinks=False):
else: else:
copy(srcname, dstname) copy(srcname, dstname)
except (IOError, os.error), why: except (IOError, os.error), why:
errors.append((srcname, dstname, why)) errors.append((srcname, dstname, 'Error: ' + str(why.strerror)))
if errors: if errors:
raise Error, errors raise Error, errors
...@@ -767,8 +767,9 @@ class SubversionTool(UniqueObject, Folder): ...@@ -767,8 +767,9 @@ class SubversionTool(UniqueObject, Folder):
dirs.remove('.svn') dirs.remove('.svn')
# get Directories # get Directories
for name in dirs: for name in dirs:
i = root.replace(directory, '').count(os.sep)
f = os.path.join(root, name) f = os.path.join(root, name)
dir_set.add(f.replace(directory,'')) dir_set.add((i, f.replace(directory,'')))
return dir_set return dir_set
# return a set with files present in the directory # return a set with files present in the directory
...@@ -780,8 +781,9 @@ class SubversionTool(UniqueObject, Folder): ...@@ -780,8 +781,9 @@ class SubversionTool(UniqueObject, Folder):
dirs.remove('.svn') dirs.remove('.svn')
# get Files # get Files
for name in files: for name in files:
i = root.replace(directory, '').count(os.sep)
f = os.path.join(root, name) f = os.path.join(root, name)
dir_set.add(f.replace(directory,'')) dir_set.add((i, f.replace(directory,'')))
return dir_set return dir_set
# return files present in new_dir but not in old_dir # return files present in new_dir but not in old_dir
...@@ -793,6 +795,9 @@ class SubversionTool(UniqueObject, Folder): ...@@ -793,6 +795,9 @@ class SubversionTool(UniqueObject, Folder):
new_dir += os.sep new_dir += os.sep
old_set = self.getSetFilesForDir(old_dir) old_set = self.getSetFilesForDir(old_dir)
new_set = self.getSetFilesForDir(new_dir) new_set = self.getSetFilesForDir(new_dir)
LOG("chrisold", 1, old_set)
LOG("chrisnew", 1, new_set)
LOG("chrisdiff", 1, new_set.difference(old_set))
return new_set.difference(old_set) return new_set.difference(old_set)
# return dirs present in new_dir but not in old_dir # return dirs present in new_dir but not in old_dir
...@@ -813,8 +818,12 @@ class SubversionTool(UniqueObject, Folder): ...@@ -813,8 +818,12 @@ class SubversionTool(UniqueObject, Folder):
# detect removed directories # detect removed directories
dirs_set = self.getNewDirs(new_dir, old_dir) dirs_set = self.getNewDirs(new_dir, old_dir)
# svn del # svn del
self.remove([os.path.join(old_dir, x) for x in files_set]) list = [x for x in files_set]
self.remove([os.path.join(old_dir, x) for x in dirs_set]) list.sort()
self.remove([os.path.join(old_dir, x[1]) for x in list])
list = [x for x in dirs_set]
list.sort()
self.remove([os.path.join(old_dir, x[1]) for x in list])
# copy files and add new files # copy files and add new files
def addNewFiles(self, old_dir, new_dir, bt): def addNewFiles(self, old_dir, new_dir, bt):
...@@ -826,8 +835,12 @@ class SubversionTool(UniqueObject, Folder): ...@@ -826,8 +835,12 @@ class SubversionTool(UniqueObject, Folder):
#os.system('cp -af %s/* %s'%(new_dir, old_dir)) #os.system('cp -af %s/* %s'%(new_dir, old_dir))
copytree(new_dir, old_dir) copytree(new_dir, old_dir)
# svn add # svn add
self.add([os.path.join(old_dir, x) for x in dirs_set]) list = [x for x in dirs_set]
self.add([os.path.join(old_dir, x) for x in files_set]) list.sort()
self.add([os.path.join(old_dir, x[1]) for x in list])
list = [x for x in files_set]
list.sort()
self.add([os.path.join(old_dir, x[1]) for x in list])
def treeToXML(self, item) : def treeToXML(self, item) :
output = "<?xml version='1.0' encoding='iso-8859-1'?>"+ os.linesep output = "<?xml version='1.0' encoding='iso-8859-1'?>"+ os.linesep
......
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