From 560ffcc017e685ba1b254da62676e12f8cd3bb93 Mon Sep 17 00:00:00 2001 From: Christophe Dumez <christophe@nexedi.com> Date: Tue, 25 Apr 2006 14:59:16 +0000 Subject: [PATCH] - Improvements to support update bt from repository git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6925 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Subversion/SubversionClient.py | 4 ++-- product/ERP5Subversion/Tool/SubversionTool.py | 24 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/product/ERP5Subversion/SubversionClient.py b/product/ERP5Subversion/SubversionClient.py index f1b49d79f1..703e87e974 100644 --- a/product/ERP5Subversion/SubversionClient.py +++ b/product/ERP5Subversion/SubversionClient.py @@ -253,8 +253,8 @@ try: os.system('rm -rf %s'%tmp) return diff - def revert(self, path): - return self.client.revert(path) + def revert(self, path, recurse=False): + return self.client.revert(path, recurse) def log(self, path): try: diff --git a/product/ERP5Subversion/Tool/SubversionTool.py b/product/ERP5Subversion/Tool/SubversionTool.py index c195378d8e..94d179654f 100644 --- a/product/ERP5Subversion/Tool/SubversionTool.py +++ b/product/ERP5Subversion/Tool/SubversionTool.py @@ -633,9 +633,12 @@ class SubversionTool(UniqueObject, Folder): """ path = self.getSubversionPath(bt) client = self._getClient() - res = client.update(path) - self.importBT(bt); - return res + # Revert first to import a "pure" BT after update + self.revert(path=path, recurse=True) + # Update from SVN + client.update(path) + # Import in zodb + return self.importBT(bt); security.declareProtected('Import/Export objects', 'add') # path can be a list or not (relative or absolute) @@ -712,15 +715,16 @@ class SubversionTool(UniqueObject, Folder): security.declareProtected('Import/Export objects', 'revert') # path can be absolute or relative - def revert(self, path, bt): + def revert(self, path, bt=None, recurse=False): """Revert local changes in a file or a directory. """ client = self._getClient() - if isinstance(path, list) : - path = [self.relativeToAbsolute(x, bt) for x in path] - else: - path = self.relativeToAbsolute(path, bt) - return client.revert(path) + if bt: + if isinstance(path, list) : + path = [self.relativeToAbsolute(x, bt) for x in path] + else: + path = self.relativeToAbsolute(path, bt) + return client.revert(path, recurse) security.declareProtected('Import/Export objects', 'resolved') # path can be absolute or relative @@ -852,7 +856,7 @@ class SubversionTool(UniqueObject, Folder): self.activate().removeAllInList([path,]) def importBT(self, bt): - bt.download(self.getSubversionPath(bt)) + return bt.download(self.getSubversionPath(bt)) # return a set with directories present in the directory def getSetDirsForDir(self, directory): -- 2.30.9