From 663d1f5ca4110e69711cecc06f51addaabcfaf1f Mon Sep 17 00:00:00 2001
From: Christophe Dumez <christophe@nexedi.com>
Date: Tue, 11 Apr 2006 09:35:17 +0000
Subject: [PATCH] - use relative path instead of absolute. Not perfect at all.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6546 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Subversion/Tool/SubversionTool.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/product/ERP5Subversion/Tool/SubversionTool.py b/product/ERP5Subversion/Tool/SubversionTool.py
index f5351333a5..16d7d7ba39 100644
--- a/product/ERP5Subversion/Tool/SubversionTool.py
+++ b/product/ERP5Subversion/Tool/SubversionTool.py
@@ -697,6 +697,12 @@ class SubversionTool(UniqueObject, Folder):
     return output
   
   def _treeToXML(self, item, output, ident, first) :
+    # svn path
+    svn_path = self.getPortalObject().portal_preferences.getPreference('subversion_working_copy')
+    if not svn_path :
+      raise "Error: Please set Subversion working path in preferences"
+    if svn_path[-1] != '/':
+      svn_path += '/'
     # Choosing a color coresponding to the status
     itemStatus = item.msg_status
     if itemStatus == 'added' :
@@ -715,12 +721,12 @@ class SubversionTool(UniqueObject, Folder):
         output += '<item open="1" text="%s" id="%s" aCol="%s" '\
         'im0="folder.png" im1="folder_open.png" '\
         'im2="folder.png">'%(item.name,
-item.full_path, itemColor,) + os.linesep
+item.full_path.replace(svn_path, ''), itemColor,) + os.linesep
         first=False
       else :
         output += '<item text="%s" id="%s" aCol="%s" im0="folder.png" ' \
       'im1="folder_open.png" im2="folder.png">'%(item.name,
-item.full_path, itemColor,) + os.linesep
+item.full_path.replace(svn_path, ''), itemColor,) + os.linesep
       for it in item.sub_dirs:
         ident += 1
         output = self._treeToXML(item.getDir(it.name), output, ident,
@@ -733,7 +739,7 @@ first)
       for i in range(ident) :
         output += '\t'
       output += '<item text="%s" id="%s" aCol="%s" im0="document.png"/>'\
-                %(item.name, item.full_path, itemColor,) + os.linesep
+                %(item.name, item.full_path.replace(svn_path, ''), itemColor,) + os.linesep
     return output
     
 InitializeClass(SubversionTool)
-- 
2.30.9