Commit 420d2ea5 authored by Christophe Dumez's avatar Christophe Dumez

- Added support for several working copies (usefull for bt in products)

- BIG code cleanup & optimisation
Note: Code has changed a lot and new bugs might have appeared although I tested a lot

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6846 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a82dff07
......@@ -66,7 +66,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>context.getPortalObject()["portal_subversion"].cleanup()\n
<value> <string>context.getPortalObject()["portal_subversion"].cleanup(context)\n
\n
context.REQUEST.set(\'portal_status_message\', \'Subversion locks removed successfully!\')\n
return context.BusinessTemplate_viewSvnStatus()\n
......
......@@ -88,12 +88,6 @@ if removed != \'\' and removed != \'none\':\n
else:\n
commit_recurs = removed\n
\n
svn_path = context.getPortalObject().portal_preferences.getPreference(\'subversion_working_copy\')\n
if not svn_path :\n
raise "Error: Please set Subversion working path in preferences"\n
if svn_path[-1]!=\'/\':\n
svn_path+=\'/\'\n
\n
if \'changelog\' not in context.REQUEST.keys() :\n
context.REQUEST.set(\'portal_status_message\', \'Please set a changelog message...\')\n
return context.asContext(added=added, modified=modified, removed=removed ,checked=checked).BusinessTemplate_viewSvnChangelog()\n
......@@ -104,12 +98,9 @@ if not changelog :\n
\n
try:\n
if commit_non_recurs != \'none\' and commit_non_recurs != \'\':\n
commit_non_recurs = [svn_path + relative_path for relative_path in commit_non_recurs]\n
context.getPortalObject()["portal_subversion"].checkin(path=commit_non_recurs, recurse=False, log_message=changelog)\n
context.getPortalObject()["portal_subversion"].checkin(path=commit_non_recurs, bt=context, recurse=False, log_message=changelog)\n
if commit_recurs != \'none\' and commit_recurs != \'\':\n
for relative_path in commit_recurs:\n
relative_path = svn_path+relative_path\n
context.getPortalObject()["portal_subversion"].checkin(path=commit_recurs, recurse=True, log_message=changelog)\n
context.getPortalObject()["portal_subversion"].checkin(path=commit_recurs, bt=context, recurse=True, log_message=changelog)\n
except SubversionSSLTrustError, error:\n
context.REQUEST.set(\'portal_status_message\', \'SSL Certificate was not recognized\')\n
return context.asContext(added=added, modified=modified, removed=removed, trust_dict = error.getTrustDict(), caller=\'commit\', changelog=changelog).BusinessTemplate_viewSvnSSLTrust()\n
......@@ -174,11 +165,6 @@ return context.BusinessTemplate_viewSvnStatus()\n
<string>None</string>
<string>commit_non_recurs</string>
<string>commit_recurs</string>
<string>svn_path</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>relative_path</string>
<string>False</string>
<string>True</string>
<string>error</string>
......
......@@ -68,12 +68,6 @@
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
svn_path = context.getPortalObject().portal_preferences.getPreference(\'subversion_working_copy\')\n
if not svn_path :\n
raise "Error: Please set Subversion working path in preferences"\n
if svn_path[-1]!=\'/\':\n
svn_path+=\'/\'\n
\n
#params modified,added,removed\n
modified=context.REQUEST["modified"]\n
added=context.REQUEST["added"]\n
......@@ -86,21 +80,21 @@ tab_Removed=removed.split(\',\')\n
\n
if modified != \'none\':\n
for f in tab_Modified:\n
f = svn_path+f \n
f = context.getPortalObject()["portal_subversion"].relativeToAbsolute(f, context) \n
print "<b><font color=\'black\'>Index: <a href=\'BusinessTemplate_viewSvnShowFile?file="+f+"\'>"+f+"</a> <a href=\'"+context.getPortalObject()["portal_subversion"].editPath(context, f)+"\'><img src=\'imgs/edit.png\' border=\'0\'></a><br>"\n
print \'<hr></font></b>\'\n
print context.getPortalObject()["portal_subversion"].diffHTML(f)\n
print context.getPortalObject()["portal_subversion"].diffHTML(f, context)\n
\n
if added != \'none\':\n
for f in tab_Added:\n
f = svn_path+f\n
f = context.getPortalObject()["portal_subversion"].relativeToAbsolute(f, context) \n
print "<b><font color=\'black\'>Index: <a href=\'BusinessTemplate_viewSvnShowFile?file="+f+"\'>"+f+"</a> <a href=\'"+context.getPortalObject()["portal_subversion"].editPath(context, f)+"\'><img src=\'imgs/edit.png\' border=\'0\'></a><br>"\n
print \'<hr></font></b>\'\n
print "<font color=\'green\'>File Added</font><br><br>"\n
\n
if removed != \'none\':\n
for f in tab_Removed:\n
f = svn_path+f\n
f = context.getPortalObject()["portal_subversion"].relativeToAbsolute(f, context) \n
print "<b><font color=\'black\'>Index: <a href=\'BusinessTemplate_viewSvnShowFile?file="+f+"\'>"+f+"</a> <a href=\'"+context.getPortalObject()["portal_subversion"].editPath(context, f)+"\'><img src=\'imgs/edit.png\' border=\'0\'></a><br>"\n
print \'<hr></font></b>\'\n
print "<font color=\'red\'>File Removed</font><br><br>"\n
......@@ -151,10 +145,9 @@ return printed\n
<tuple>
<string>_print_</string>
<string>_print</string>
<string>_getitem_</string>
<string>_getattr_</string>
<string>context</string>
<string>svn_path</string>
<string>_getitem_</string>
<string>modified</string>
<string>added</string>
<string>removed</string>
......
......@@ -69,7 +69,7 @@
<value> <string>from Products.ERP5Subversion.SubversionClient import SubversionSSLTrustError, SubversionLoginError\n
\n
try:\n
entry_dict = context.getPortalObject()["portal_subversion"].info()\n
entry_dict = context.getPortalObject()["portal_subversion"].info(context)\n
except SubversionSSLTrustError, error:\n
context.REQUEST.set(\'portal_status_message\', \'SSL Certificate was not recognized\')\n
return context.asContext(trust_dict = error.getTrustDict(), caller=\'info\').BusinessTemplate_viewSvnSSLTrust()\n
......
......@@ -68,12 +68,7 @@
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Subversion.SubversionClient import SubversionSSLTrustError, SubversionLoginError\n
from Products.ERP5Type.Document import newTempBase\n
svn_path = context.getPortalObject().portal_preferences.getPreference(\'subversion_working_copy\')\n
if not svn_path :\n
raise "Error: Please set Subversion working path in preferences"\n
if svn_path[-1]!=\'/\':\n
svn_path+=\'/\'\n
working_copy = svn_path + context.getTitle()\n
working_copy = context.getPortalObject()["portal_subversion"].getSubversionPath(context)\n
\n
try:\n
unversioned_list = context.getPortalObject()["portal_subversion"].unversionedFiles(working_copy)\n
......@@ -141,9 +136,8 @@ return object_list\n
<string>Products.ERP5Type.Document</string>
<string>newTempBase</string>
<string>_getattr_</string>
<string>context</string>
<string>svn_path</string>
<string>_getitem_</string>
<string>context</string>
<string>working_copy</string>
<string>unversioned_list</string>
<string>error</string>
......
......@@ -70,14 +70,9 @@
from Products.ERP5Subversion.SubversionClient import SubversionSSLTrustError, SubversionLoginError\n
from Products.ERP5Type.Document import newTempBase\n
svn_path = context.getPortalObject().portal_preferences.getPreference(\'subversion_working_copy\')\n
if not svn_path :\n
raise "Error: Please set Subversion working path in preferences"\n
if svn_path[-1]!=\'/\':\n
svn_path+=\'/\'\n
file = svn_path + file\n
\n
try:\n
log_list = context.getPortalObject()["portal_subversion"].log(file)\n
log_list = context.getPortalObject()["portal_subversion"].log(file, context)\n
except SubversionSSLTrustError, error:\n
context.REQUEST.set(\'portal_status_message\', \'SSL Certificate was not recognized\')\n
return context.asContext(trust_dict = error.getTrustDict(), caller=\'log\').BusinessTemplate_viewSvnSSLTrust()\n
......@@ -147,9 +142,8 @@ return object_list\n
<string>Products.ERP5Type.Document</string>
<string>newTempBase</string>
<string>_getattr_</string>
<string>context</string>
<string>svn_path</string>
<string>_getitem_</string>
<string>context</string>
<string>log_list</string>
<string>error</string>
<string>error1</string>
......
......@@ -67,15 +67,9 @@
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Subversion.SubversionClient import SubversionSSLTrustError, SubversionLoginError\n
svn_path = context.getPortalObject().portal_preferences.getPreference(\'subversion_working_copy\')\n
if not svn_path :\n
raise "Error: Please set Subversion working path in preferences"\n
if svn_path[-1]!=\'/\':\n
svn_path+=\'/\'\n
file = svn_path + file\n
\n
try:\n
infos_list = context.getPortalObject()["portal_subversion"].ls(file)\n
infos_list = context.getPortalObject()["portal_subversion"].ls(file, context)\n
except SubversionSSLTrustError, error:\n
context.REQUEST.set(\'portal_status_message\', \'SSL Certificate was not recognized\')\n
return context.asContext(trust_dict = error.getTrustDict(), caller=\'ls\').BusinessTemplate_viewSvnSSLTrust()\n
......@@ -131,9 +125,8 @@ else:\n
<string>SubversionSSLTrustError</string>
<string>SubversionLoginError</string>
<string>_getattr_</string>
<string>context</string>
<string>svn_path</string>
<string>_getitem_</string>
<string>context</string>
<string>infos_list</string>
<string>error</string>
<string>error1</string>
......
......@@ -82,16 +82,9 @@ if len(revisions_list) != 2:\n
\n
revisions_list.sort()\n
\n
svn_path = context.getPortalObject().portal_preferences.getPreference(\'subversion_working_copy\')\n
if not svn_path :\n
raise "Error: Please set Subversion working path in preferences"\n
if svn_path[-1]!=\'/\':\n
svn_path += \'/\'\n
file = svn_path + file\n
\n
diff = "<b><font color=\'black\'>Index: <a href=\'BusinessTemplate_viewSvnShowFile?file="+file+"\'>"+file+"</a> <a href=\'"+context.getPortalObject()["portal_subversion"].editPath(context, file)+"\'><img src=\'imgs/edit.png\' border=\'0\'></a><br>"\n
diff = "<b><font color=\'black\'>Index: <a href=\'BusinessTemplate_viewSvnShowFile?file="+context.getPortalObject()["portal_subversion"].relativeToAbsolute(file)+"\'>"+context.getPortalObject()["portal_subversion"].relativeToAbsolute(file)+"</a> <a href=\'"+context.getPortalObject()["portal_subversion"].editPath(context, file)+"\'><img src=\'imgs/edit.png\' border=\'0\'></a><br>"\n
diff += \'<hr></b>\'\n
diff += context.getPortalObject()["portal_subversion"].diffHTML(file, revision1=revisions_list[0], revision2=revisions_list[1])\n
diff += context.getPortalObject()["portal_subversion"].diffHTML(file, context, revision1=revisions_list[0], revision2=revisions_list[1])\n
diff += \'</font>\'\n
return context.asContext(diff=diff).BusinessTemplate_viewSvnMultiDiff()\n
......@@ -143,7 +136,6 @@ return context.asContext(diff=diff).BusinessTemplate_viewSvnMultiDiff()\n
<string>file</string>
<string>revisions_list</string>
<string>len</string>
<string>svn_path</string>
<string>diff</string>
</tuple>
</value>
......
......@@ -71,15 +71,8 @@
else:\n
to_revert = files\n
\n
svn_path = context.getPortalObject().portal_preferences.getPreference(\'subversion_working_copy\')\n
if not svn_path :\n
raise "Error: Please set Subversion working path in preferences"\n
if svn_path[-1]!=\'/\':\n
svn_path+=\'/\'\n
\n
if to_revert != \'none\' :\n
to_revert = [svn_path + relative_path for relative_path in to_revert]\n
context.getPortalObject()["portal_subversion"].revert(path=to_revert)\n
if to_revert != \'none\' and to_revert != \'\':\n
context.getPortalObject()["portal_subversion"].revert(path=to_revert, bt=context)\n
\n
context.REQUEST.set(\'portal_status_message\', \'Changes reverted successfully!\')\n
return context.BusinessTemplate_viewSvnStatus()\n
......@@ -126,13 +119,8 @@ return context.BusinessTemplate_viewSvnStatus()\n
<string>files</string>
<string>_getattr_</string>
<string>to_revert</string>
<string>context</string>
<string>svn_path</string>
<string>_getitem_</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>relative_path</string>
<string>context</string>
</tuple>
</value>
</item>
......
......@@ -67,13 +67,7 @@
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Subversion.SubversionClient import SubversionSSLTrustError, SubversionLoginError\n
\n
svn_path = context.getPortalObject().portal_preferences.getPreference(\'subversion_working_copy\')\n
if not svn_path :\n
raise "Error: Please set Subversion working path in preferences"\n
if svn_path[-1]!=\'/\':\n
svn_path+=\'/\'\n
svn_path += context.getTitle()\n
svn_path = context.getPortalObject()["portal_subversion"].getSubversionPath(context)\n
\n
try:\n
context.getPortalObject()["portal_subversion"].update(svn_path)\n
......@@ -130,9 +124,9 @@ return context.BusinessTemplate_viewSvnStatus()\n
<string>SubversionSSLTrustError</string>
<string>SubversionLoginError</string>
<string>_getattr_</string>
<string>_getitem_</string>
<string>context</string>
<string>svn_path</string>
<string>_getitem_</string>
<string>error</string>
<string>error1</string>
</tuple>
......
......@@ -59,7 +59,7 @@
infos_dict context/infos_dict">\n
\n
<font color=\'black\'>\n
<br><a tal:attributes="href python:\'BusinessTemplate_viewSvnShowFile?file=\'+str(path)"><b tal:content="path"></b></a>\n
<br><a tal:attributes="href python:\'BusinessTemplate_viewSvnShowFile?file=\'+str(path)"><b tal:content="python:context.getPortalObject()[\'portal_subversion\'].relativeToAbsolute(path,context)"></b></a>\n
<a tal:attributes="href context/edit_path"><img src=\'imgs/edit.png\' border=\'0\'></a><hr><br>\n
<span tal:condition="infos_dict">\n
<table width=60%% border=1>\n
......
......@@ -74,8 +74,7 @@
<value>
<list>
<string>my_preferred_subversion_user_name</string>
<string>my_preferred_subversion_working_copy</string>
<string>my_preferred_bootstrap_working_copy</string>
<string>my_preferred_subversion_working_copy_list</string>
</list>
</value>
</item>
......
......@@ -5,7 +5,7 @@
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>StringField</string>
<string>LinesField</string>
</tuple>
<none/>
</tuple>
......@@ -14,7 +14,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_preferred_subversion_working_copy</string> </value>
<value> <string>my_preferred_subversion_working_copy_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -24,13 +24,21 @@
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>line_too_long</string> </key>
<value> <string>A line was too long.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>Too much input was given.</string> </value>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item>
</dictionary>
</value>
......@@ -55,14 +63,6 @@
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
......@@ -79,6 +79,10 @@
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
......@@ -87,6 +91,14 @@
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
......@@ -96,17 +108,21 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -130,14 +146,6 @@
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
......@@ -154,6 +162,10 @@
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
......@@ -162,6 +174,14 @@
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
......@@ -171,17 +191,21 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -205,14 +229,6 @@
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
......@@ -229,6 +245,10 @@
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
......@@ -237,26 +257,43 @@
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Working copy Path (bt5)</string> </value>
<value> <string>my_preferred_subversion_working_copy_list</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
<key> <string>view_separator</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br />\n
]]></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>40</int> </value>
</item>
</dictionary>
</value>
</item>
......
......@@ -70,20 +70,14 @@
context.getPortalObject().portal_subversion.extractBT(context)\n
\n
bt_name = context.getPortalObject()["portal_templates"][context.getId()].getTitle()\n
context.REQUEST.RESPONSE.setHeader(\'Content-Type\', \'text/xml;; charset=utf-8\')\n
path = context.getPortalObject().portal_preferences.getPreferredSubversionWorkingCopy()\n
if not path :\n
raise "Error: Please set Subversion working path in preferences"\n
if path[-1] != \'/\':\n
path += \'/\'\n
path+=bt_name\n
root = context.getPortalObject().portal_subversion.getModifiedTree(path)\n
\n
root = context.getPortalObject().portal_subversion.getModifiedTree(context)\n
if not root:\n
return \'\'\'<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>\n
<tree id=\'0\'></tree>\'\'\'\n
\n
return context.getPortalObject().portal_subversion.treeToXML(root).strip()\n
return context.getPortalObject().portal_subversion.treeToXML(root, context).strip()\n
]]></string> </value>
......@@ -128,9 +122,6 @@ return context.getPortalObject().portal_subversion.treeToXML(root).strip()\n
<tuple>
<string>_getattr_</string>
<string>context</string>
<string>_getitem_</string>
<string>bt_name</string>
<string>path</string>
<string>root</string>
</tuple>
</value>
......
2006-04-21 chris
* added subversion support for several
working copies
2006-04-10 chris
* added Subversion Tool integration
......
0.2
\ No newline at end of file
0.3
\ No newline at end of file
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