Commit 2cff7d32 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Migrate Products.ERP5VCS (MR !973).

Moved 'git_askpass' shell script to product/ERP5/bin (considering that this
is a very short shell script which hasn't changed in 7 years, no need to move
it to the ZODB which would require creating a temporary file...).

After updating erp5_forge, you should delete 'product/ERP5VCS/' directory
as this will only contain '.pyc' files.

/reviewed-on nexedi/erp5!973
parent c7a292ba
...@@ -64,7 +64,7 @@ def findMessageListFromPythonInProduct(function_name_list): ...@@ -64,7 +64,7 @@ def findMessageListFromPythonInProduct(function_name_list):
product_dir = os.path.dirname(Products.ERP5.__path__[0]) product_dir = os.path.dirname(Products.ERP5.__path__[0])
erp5_product_list = ('CMFActivity', 'CMFCategory', erp5_product_list = ('CMFActivity', 'CMFCategory',
'ERP5', 'ERP5Banking', 'ERP5Catalog', 'ERP5Configurator', 'ERP5', 'ERP5Banking', 'ERP5Catalog', 'ERP5Configurator',
'ERP5Form', 'ERP5OOo', 'ERP5Security', 'ERP5VCS', 'ERP5Form', 'ERP5OOo', 'ERP5Security',
'ERP5SyncML', 'ERP5Type', 'ERP5Wizard', 'ERP5Workflow', 'ERP5SyncML', 'ERP5Type', 'ERP5Wizard', 'ERP5Workflow',
'HBTreeFolder2', 'MailTemplates', 'TimerService', 'HBTreeFolder2', 'MailTemplates', 'TimerService',
'ZMySQLDA', 'ZSQLCatalog', 'ZMySQLDA', 'ZSQLCatalog',
......
...@@ -33,11 +33,12 @@ from Acquisition import aq_base ...@@ -33,11 +33,12 @@ from Acquisition import aq_base
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
from ZTUtils import make_query from ZTUtils import make_query
from Products.ERP5VCS.WorkingCopy import \ from erp5.component.module.WorkingCopy import \
WorkingCopy, NotAWorkingCopyError, NotVersionedError, Dir, File, selfcached WorkingCopy, NotAWorkingCopyError, NotVersionedError, Dir, File, selfcached
# TODO: write a similar helper for 'nt' platform # TODO: write a similar helper for 'nt' platform
GIT_ASKPASS = os.path.join(os.path.dirname(__file__), 'bin', 'git_askpass') import Products.ERP5
GIT_ASKPASS = os.path.join(Products.ERP5.product_path, 'bin', 'git_askpass')
class GitInstallationError(EnvironmentError): class GitInstallationError(EnvironmentError):
"""Raised when an installation is broken""" """Raised when an installation is broken"""
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Module Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>Git</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5VCS.Git</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>module.erp5.Git</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Module Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -36,11 +36,10 @@ from ZTUtils import make_query ...@@ -36,11 +36,10 @@ from ZTUtils import make_query
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Utils import simple_decorator from Products.ERP5Type.Utils import simple_decorator
from Products.ERP5.Document.BusinessTemplate import BusinessTemplateFolder from Products.ERP5.Document.BusinessTemplate import BusinessTemplateFolder
from Products.ERP5VCS.WorkingCopy import \ from erp5.component.module.WorkingCopy import \
WorkingCopy, Dir, File, selfcached, \ WorkingCopy, Dir, File, selfcached, \
NotAWorkingCopyError, NotVersionedError, VcsConflictError NotAWorkingCopyError, NotVersionedError, VcsConflictError
from Products.ERP5VCS.SubversionClient import \ from erp5.component.module.SubversionClient import newSubversionClient
newSubversionClient, SubversionLoginError, SubversionSSLTrustError
# XXX Still not thread safe !!! Proper fix is to never use 'os.chdir' # XXX Still not thread safe !!! Proper fix is to never use 'os.chdir'
# Using a RLock is a temporary quick change that only protects against # Using a RLock is a temporary quick change that only protects against
...@@ -346,17 +345,17 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder): ...@@ -346,17 +345,17 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder):
try: try:
if path in self.svn_file_set: if path in self.svn_file_set:
self.svn_file_set.remove(path) self.svn_file_set.remove(path)
file = open(path, 'r+b') file_obj = open(path, 'r+b')
old_size = os.fstat(file.fileno()).st_size old_size = os.fstat(file_obj.fileno()).st_size
if len(obj) == old_size and obj == file.read(): if len(obj) == old_size and obj == file_obj.read():
return return
file.seek(0) file_obj.seek(0)
else: else:
file = open(path, 'wb') file_obj = open(path, 'wb')
file.write(obj) file_obj.write(obj)
file.truncate() file_obj.truncate()
finally: finally:
file.close() file_obj.close()
def _makeParent(self, path): def _makeParent(self, path):
path = os.path.dirname(path) path = os.path.dirname(path)
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Module Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>Subversion</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5VCS.Subversion</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>module.erp5.Subversion</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Module Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -39,7 +39,6 @@ from Products.ERP5Type.Globals import InitializeClass ...@@ -39,7 +39,6 @@ from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl.SecurityInfo import ModuleSecurityInfo from AccessControl.SecurityInfo import ModuleSecurityInfo
from Products.PythonScripts.Utility import allow_class
from tempfile import mkdtemp from tempfile import mkdtemp
import shutil import shutil
...@@ -179,7 +178,7 @@ try: ...@@ -179,7 +178,7 @@ try:
def __call__(self, instance): def __call__(self, instance):
value = getattr(instance._obj, self._key) value = getattr(instance._obj, self._key)
if type(value) == type(u''): if isinstance(value, unicode):
value = value.encode('utf-8') value = value.encode('utf-8')
#elif isinstance(value, pysvn.Entry): #elif isinstance(value, pysvn.Entry):
elif str(type(value)) == "<type 'entry'>": elif str(type(value)) == "<type 'entry'>":
...@@ -275,7 +274,7 @@ try: ...@@ -275,7 +274,7 @@ try:
except pysvn.ClientError, error: except pysvn.ClientError, error:
excep = self.getException() excep = self.getException()
if excep: if excep:
raise excep raise excep # pylint: disable=raising-bad-type
else: else:
raise error raise error
...@@ -285,7 +284,7 @@ try: ...@@ -285,7 +284,7 @@ try:
except pysvn.ClientError, error: except pysvn.ClientError, error:
excep = self.getException() excep = self.getException()
if excep: if excep:
raise excep raise excep # pylint: disable=raising-bad-type
else: else:
raise error raise error
...@@ -297,7 +296,7 @@ try: ...@@ -297,7 +296,7 @@ try:
except pysvn.ClientError, error: except pysvn.ClientError, error:
excep = self.getException() excep = self.getException()
if excep: if excep:
raise excep raise excep # pylint: disable=raising-bad-type
else: else:
raise error raise error
# XXX: seems that pysvn return a list that is # XXX: seems that pysvn return a list that is
...@@ -334,7 +333,7 @@ try: ...@@ -334,7 +333,7 @@ try:
return return
excep = self.getException() excep = self.getException()
if excep: if excep:
raise excep raise excep # pylint: disable=raising-bad-type
else: else:
raise error raise error
# Edit list to make it more usable in zope # Edit list to make it more usable in zope
...@@ -365,7 +364,7 @@ try: ...@@ -365,7 +364,7 @@ try:
except pysvn.ClientError, error: except pysvn.ClientError, error:
excep = self.getException() excep = self.getException()
if excep: if excep:
raise excep raise excep # pylint: disable=raising-bad-type
else: else:
raise error raise error
if entry is None: if entry is None:
...@@ -387,7 +386,7 @@ try: ...@@ -387,7 +386,7 @@ try:
return return
excep = self.getException() excep = self.getException()
if excep: if excep:
raise excep raise excep # pylint: disable=raising-bad-type
else: else:
raise error raise error
#Modify the list to make it more usable in zope #Modify the list to make it more usable in zope
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Module Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SubversionClient</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5VCS.SubversionClient</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>module.erp5.SubversionClient</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Module Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 83, 2: __init__ method from base class \'SubversionError\' is not called (super-init-not-called)</string>
<string>W: 99, 2: __init__ method from base class \'SubversionError\' is not called (super-init-not-called)</string>
<string>W:137, 4: Arguments number differs from overridden \'__call__\' method (arguments-differ)</string>
<string>W:150, 4: Arguments number differs from overridden \'__call__\' method (arguments-differ)</string>
<string>W:155, 4: Arguments number differs from overridden \'__call__\' method (arguments-differ)</string>
</tuple>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -85,8 +85,8 @@ class WorkingCopy(Implicit): ...@@ -85,8 +85,8 @@ class WorkingCopy(Implicit):
class __metaclass__(ImplicitType): class __metaclass__(ImplicitType):
def __init__(cls, name, bases, d): def __init__(cls, name, bases, d): # pylint: disable=no-self-argument,super-init-not-called
ImplicitType.__init__(cls, name, bases, d) ImplicitType.__init__(cls, name, bases, d) # pylint: disable=non-parent-init-called
if cls.reference: if cls.reference:
cls._registry.append((cls.reference, cls)) cls._registry.append((cls.reference, cls))
...@@ -334,6 +334,14 @@ class WorkingCopy(Implicit): ...@@ -334,6 +334,14 @@ class WorkingCopy(Implicit):
def getVcsTool(vcs=None, path=None, restricted=False): def getVcsTool(vcs=None, path=None, restricted=False):
## Initialization of WorkingCopy._registry (used to be done in Products.ERP5VCS __init__)
# Register Subversion before Git
try:
from erp5.component.module import Subversion as _
except ImportError:
pass
from erp5.component.module import Git as _
if vcs: if vcs:
for x in WorkingCopy._registry: for x in WorkingCopy._registry:
if x[0] == vcs: if x[0] == vcs:
...@@ -357,26 +365,26 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder): ...@@ -357,26 +365,26 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder):
self._makeParent(path) self._makeParent(path)
path = os.path.join(self.path, path) path = os.path.join(self.path, path)
# write file unless unchanged # write file unless unchanged
file = None file_obj = None
try: try:
try: try:
file = open(path, 'r+b') file_obj = open(path, 'r+b')
except IOError, e: except IOError, e:
if e.errno == errno.EISDIR: if e.errno == errno.EISDIR:
shutil.rmtree(path, ignore_errors=True) shutil.rmtree(path, ignore_errors=True)
elif e.errno != errno.ENOENT: elif e.errno != errno.ENOENT:
raise raise
file = open(path, 'wb') file_obj = open(path, 'wb')
else: else:
old_size = os.fstat(file.fileno()).st_size old_size = os.fstat(file_obj.fileno()).st_size
if len(obj) == old_size and obj == file.read(): if len(obj) == old_size and obj == file_obj.read():
return return
file.seek(0) file_obj.seek(0)
file.write(obj) file_obj.write(obj)
file.truncate() file_obj.truncate()
finally: finally:
if file is not None: if file_obj is not None:
file.close() file_obj.close()
def _makeParent(self, path): def _makeParent(self, path):
path = os.path.dirname(path) path = os.path.dirname(path)
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Module Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>WorkingCopy</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5VCS.WorkingCopy</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>module.erp5.WorkingCopy</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Module Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.ERP5VCS.SubversionClient import SubversionSSLTrustError from erp5.component.module.SubversionClient import SubversionSSLTrustError
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
portal = context.getPortalObject() portal = context.getPortalObject()
......
from Products.ERP5VCS.SubversionClient import SubversionSSLTrustError, SubversionLoginError from erp5.component.module.SubversionClient import SubversionSSLTrustError, SubversionLoginError
vcs_tool = context.getVcsTool() vcs_tool = context.getVcsTool()
try: try:
......
from Products.ERP5VCS.SubversionClient import SubversionSSLTrustError, SubversionLoginError from erp5.component.module.SubversionClient import SubversionSSLTrustError, SubversionLoginError
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
# get selected business templates # get selected business templates
......
# try to get the repository URL, else redirect to the dialog for creating a working copy in one of the configured repositories # try to get the repository URL, else redirect to the dialog for creating a working copy in one of the configured repositories
from Products.ERP5VCS.WorkingCopy import NotAWorkingCopyError from erp5.component.module.WorkingCopy import NotAWorkingCopyError
try: try:
return context.getVcsTool().getRemoteUrl() return context.getVcsTool().getRemoteUrl()
except NotAWorkingCopyError: except NotAWorkingCopyError:
......
from Products.ERP5VCS.Git import GitLoginError from erp5.component.module.Git import GitLoginError
from Products.ERP5VCS.SubversionClient import SubversionSSLTrustError, SubversionLoginError from erp5.component.module.SubversionClient import SubversionSSLTrustError, SubversionLoginError
try: try:
raise exception raise exception
......
module.erp5.Git
module.erp5.Subversion
module.erp5.SubversionClient
module.erp5.WorkingCopy
\ No newline at end of file
...@@ -5801,7 +5801,10 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5801,7 +5801,10 @@ Business Template is a set of definitions, such as skins, portal types and categ
@transactional_cached(lambda self, vcs=None, path=None, restricted=False: @transactional_cached(lambda self, vcs=None, path=None, restricted=False:
(self, vcs, path, restricted)) (self, vcs, path, restricted))
def _getVcsTool(self, vcs=None, path=None, restricted=False): def _getVcsTool(self, vcs=None, path=None, restricted=False):
from Products.ERP5VCS.WorkingCopy import getVcsTool try:
from erp5.component.module.WorkingCopy import getVcsTool
except ImportError:
raise RuntimeError("VCS features require 'erp5_forge' bt5")
if not (path or vcs): if not (path or vcs):
path = self.getExportPath() path = self.getExportPath()
return getVcsTool(vcs, path, restricted).__of__(self) return getVcsTool(vcs, path, restricted).__of__(self)
...@@ -5811,10 +5814,10 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5811,10 +5814,10 @@ Business Template is a set of definitions, such as skins, portal types and categ
def isVcsType(self, *vcs): def isVcsType(self, *vcs):
# could be moved to Products.ERP5.Base.Base # could be moved to Products.ERP5.Base.Base
from Products.ERP5VCS.WorkingCopy import NotAWorkingCopyError
try: try:
from erp5.component.module.WorkingCopy import NotAWorkingCopyError
return self.getVcsTool().reference in vcs return self.getVcsTool().reference in vcs
except NotAWorkingCopyError: except (ImportError, NotAWorkingCopyError):
return None in vcs return None in vcs
security.declareProtected(Permissions.ManagePortal, 'export') security.declareProtected(Permissions.ManagePortal, 'export')
...@@ -5885,7 +5888,12 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5885,7 +5888,12 @@ Business Template is a set of definitions, such as skins, portal types and categ
prop_dict[pid[:-5]] = (value or '').splitlines() prop_dict[pid[:-5]] = (value or '').splitlines()
self._edit(**prop_dict) self._edit(**prop_dict)
from Products.ERP5VCS.WorkingCopy import NotAWorkingCopyError try:
from erp5.component.module.WorkingCopy import NotAWorkingCopyError
# bootstrap (setupERP5Core()) or erp5_forge not installed
except ImportError:
pass
else:
try: try:
vcs_tool = self._getVcsTool(path=path) vcs_tool = self._getVcsTool(path=path)
except NotAWorkingCopyError: except NotAWorkingCopyError:
......
...@@ -343,10 +343,14 @@ class TemplateTool (BaseTool): ...@@ -343,10 +343,14 @@ class TemplateTool (BaseTool):
os.remove(temppath) os.remove(temppath)
def _download_svn(self, url, bt_id): def _download_svn(self, url, bt_id):
try:
from erp5.component.module.WorkingCopy import getVcsTool
except ImportError:
raise RuntimeError("VCS features require 'erp5_forge' bt5")
svn_checkout_tmp_dir = mkdtemp() svn_checkout_tmp_dir = mkdtemp()
svn_checkout_dir = os.path.join(svn_checkout_tmp_dir, 'bt') svn_checkout_dir = os.path.join(svn_checkout_tmp_dir, 'bt')
try: try:
from Products.ERP5VCS.WorkingCopy import getVcsTool
getVcsTool('svn').__of__(self).export(url, svn_checkout_dir) getVcsTool('svn').__of__(self).export(url, svn_checkout_dir)
return self._download_local(svn_checkout_dir, bt_id) return self._download_local(svn_checkout_dir, bt_id)
finally: finally:
......
...@@ -34,7 +34,6 @@ import random ...@@ -34,7 +34,6 @@ import random
import tempfile import tempfile
from xml.dom.minidom import getDOMImplementation from xml.dom.minidom import getDOMImplementation
from App.config import getConfiguration from App.config import getConfiguration
from Products.ERP5VCS.WorkingCopy import getVcsTool
from Products.ERP5.Document.BusinessTemplate import \ from Products.ERP5.Document.BusinessTemplate import \
BusinessTemplateMissingDependency BusinessTemplateMissingDependency
...@@ -53,7 +52,9 @@ class TestTemplateTool(ERP5TypeTestCase): ...@@ -53,7 +52,9 @@ class TestTemplateTool(ERP5TypeTestCase):
'erp5_full_text_mroonga_catalog', 'erp5_full_text_mroonga_catalog',
'erp5_base', 'erp5_base',
'erp5_stock_cache', 'erp5_stock_cache',
'erp5_csv_style') 'erp5_csv_style',
'erp5_crm',
'erp5_forge')
def getTitle(self): def getTitle(self):
return "Template Tool" return "Template Tool"
...@@ -109,6 +110,7 @@ class TestTemplateTool(ERP5TypeTestCase): ...@@ -109,6 +110,7 @@ class TestTemplateTool(ERP5TypeTestCase):
""" """
Function used to trust in svn.erp5.org. Function used to trust in svn.erp5.org.
""" """
from erp5.component.module.WorkingCopy import getVcsTool
for trust_dict in [ for trust_dict in [
# for subversion 1.6 # for subversion 1.6
{'failures': 8, {'failures': 8,
......
ERP5VCS
ERP5VCS provides a Subversion interface. This product
depends on "pysvn":http://pysvn.tigris.org/.
To use this product, you must make a directory named 'svn' under
your instance home, and check out repositories under the directory.
Note that you must make sure that Zope can write to the directory and
sub-directories.
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
# Yoshinori Okuji <yo@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
"""
ERP5 Free Software ERP
"""
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Define object classes and tools
object_classes = ()
portal_tools = ()
content_classes = ()
content_constructors = ()
# Finish installation
def initialize( context ):
import Document
initializeProduct(context, this_module, globals(),
document_module = Document,
document_classes = document_classes,
object_classes = object_classes,
portal_tools = portal_tools,
content_constructors = content_constructors,
content_classes = content_classes)
# Register Subversion before Git
try:
from Products.ERP5VCS.Subversion import Subversion
except ImportError:
# Used by BusinessTemplate_handleException
from Products.ERP5VCS.SubversionClient import SubversionSSLTrustError, SubversionLoginError
from Products.ERP5VCS.Git import Git
# make this directory a package
...@@ -11,7 +11,7 @@ class _ERP5(ERP5TypeTestSuite): ...@@ -11,7 +11,7 @@ class _ERP5(ERP5TypeTestSuite):
enabled_product_list = ('CMFActivity', 'CMFCategory', 'ERP5', 'ERP5Catalog', enabled_product_list = ('CMFActivity', 'CMFCategory', 'ERP5', 'ERP5Catalog',
'ERP5eGovSecurity', 'ERP5Form', 'ERP5eGovSecurity', 'ERP5Form',
'ERP5OOo', 'ERP5Security', 'ERP5SyncML', 'ERP5Type', 'ERP5OOo', 'ERP5Security', 'ERP5SyncML', 'ERP5Type',
'ERP5VCS', 'ERP5Wizard', 'Formulator', 'ERP5Workflow', 'ERP5Wizard', 'Formulator', 'ERP5Workflow',
'ERP5Configurator','HBTreeFolder2', 'MailTemplates', 'ERP5Configurator','HBTreeFolder2', 'MailTemplates',
'PortalTransforms', 'TimerService', 'ZLDAPConnection', 'PortalTransforms', 'TimerService', 'ZLDAPConnection',
'ZLDAPMethods', 'ZMySQLDA', 'ZSQLCatalog', 'Zelenium') 'ZLDAPMethods', 'ZMySQLDA', 'ZSQLCatalog', 'Zelenium')
......
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