Commit 80533b3b authored by Christophe Dumez's avatar Christophe Dumez

- code cleanup + little optimization


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7240 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent be47b5d2
...@@ -518,6 +518,7 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -518,6 +518,7 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
if os.path.exists(tmp_path): if os.path.exists(tmp_path):
head = "<b>"+tmp_path+"</b> (svn temporary file)<hr>" head = "<b>"+tmp_path+"</b> (svn temporary file)<hr>"
text = commands.getoutput('enscript -B --color --line-numbers --highlight=html --language=html -o - %s'%tmp_path) text = commands.getoutput('enscript -B --color --line-numbers --highlight=html --language=html -o - %s'%tmp_path)
# remove heading & trailing useless stuff
text = head + os.linesep.join(text.split(os.linesep)[10:-4]) text = head + os.linesep.join(text.split(os.linesep)[10:-4])
else : # does not exist else : # does not exist
text = "<b>"+file_path+"</b><hr>" text = "<b>"+file_path+"</b><hr>"
...@@ -574,9 +575,9 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -574,9 +575,9 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
wc_list = self.getPortalObject().portal_preferences.default_site_preference.getPreferredSubversionWorkingCopyList() wc_list = self.getPortalObject().portal_preferences.default_site_preference.getPreferredSubversionWorkingCopyList()
if not wc_list: if not wc_list:
raise SubversionPreferencesError, 'Please set at least one Subversion Working Copy in preferences first.' raise SubversionPreferencesError, 'Please set at least one Subversion Working Copy in preferences first.'
bt_name = bt.getTitle()
if len(wc_list) == 0 : if len(wc_list) == 0 :
raise SubversionPreferencesError, 'Please set at least one Subversion Working Copy in preferences first.' raise SubversionPreferencesError, 'Please set at least one Subversion Working Copy in preferences first.'
bt_name = bt.getTitle()
for wc in wc_list: for wc in wc_list:
if bt_name in os.listdir(wc) : if bt_name in os.listdir(wc) :
wc_path = os.path.join(wc, bt_name) wc_path = os.path.join(wc, bt_name)
...@@ -593,7 +594,7 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -593,7 +594,7 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
""" """
path = self.getSubversionPath(bt) path = self.getSubversionPath(bt)
client = self._getClient() client = self._getClient()
# Revert first to import a "pure" BT after update # Revert local changes in working copy first to import a "pure" BT after update
self.revert(path=path, recurse=True) self.revert(path=path, recurse=True)
# Update from SVN # Update from SVN
client.update(path) client.update(path)
......
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