Commit 2cff7d32 by 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 !973
parent c7a292ba
......@@ -64,7 +64,7 @@ def findMessageListFromPythonInProduct(function_name_list):
product_dir = os.path.dirname(Products.ERP5.__path__[0])
erp5_product_list = ('CMFActivity', 'CMFCategory',
'ERP5', 'ERP5Banking', 'ERP5Catalog', 'ERP5Configurator',
'ERP5Form', 'ERP5OOo', 'ERP5Security', 'ERP5VCS',
'ERP5Form', 'ERP5OOo', 'ERP5Security',
'ERP5SyncML', 'ERP5Type', 'ERP5Wizard', 'ERP5Workflow',
'HBTreeFolder2', 'MailTemplates', 'TimerService',
'ZMySQLDA', 'ZSQLCatalog',
......
......@@ -33,11 +33,12 @@ from Acquisition import aq_base
from DateTime import DateTime
from Products.ERP5Type.Message import translateString
from ZTUtils import make_query
from Products.ERP5VCS.WorkingCopy import \
from erp5.component.module.WorkingCopy import \
WorkingCopy, NotAWorkingCopyError, NotVersionedError, Dir, File, selfcached
# 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):
"""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
from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Utils import simple_decorator
from Products.ERP5.Document.BusinessTemplate import BusinessTemplateFolder
from Products.ERP5VCS.WorkingCopy import \
from erp5.component.module.WorkingCopy import \
WorkingCopy, Dir, File, selfcached, \
NotAWorkingCopyError, NotVersionedError, VcsConflictError
from Products.ERP5VCS.SubversionClient import \
newSubversionClient, SubversionLoginError, SubversionSSLTrustError
from erp5.component.module.SubversionClient import newSubversionClient
# 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
......@@ -346,17 +345,17 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder):
try:
if path in self.svn_file_set:
self.svn_file_set.remove(path)
file = open(path, 'r+b')
old_size = os.fstat(file.fileno()).st_size
if len(obj) == old_size and obj == file.read():
file_obj = open(path, 'r+b')
old_size = os.fstat(file_obj.fileno()).st_size
if len(obj) == old_size and obj == file_obj.read():
return
file.seek(0)
file_obj.seek(0)
else:
file = open(path, 'wb')
file.write(obj)
file.truncate()
file_obj = open(path, 'wb')
file_obj.write(obj)
file_obj.truncate()
finally:
file.close()
file_obj.close()
def _makeParent(self, 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
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from AccessControl import ClassSecurityInfo
from AccessControl.SecurityInfo import ModuleSecurityInfo
from Products.PythonScripts.Utility import allow_class
from tempfile import mkdtemp
import shutil
......@@ -179,7 +178,7 @@ try:
def __call__(self, instance):
value = getattr(instance._obj, self._key)
if type(value) == type(u''):
if isinstance(value, unicode):
value = value.encode('utf-8')
#elif isinstance(value, pysvn.Entry):
elif str(type(value)) == "<type 'entry'>":
......@@ -275,7 +274,7 @@ try:
except pysvn.ClientError, error:
excep = self.getException()
if excep:
raise excep
raise excep # pylint: disable=raising-bad-type
else:
raise error
......@@ -285,7 +284,7 @@ try:
except pysvn.ClientError, error:
excep = self.getException()
if excep:
raise excep
raise excep # pylint: disable=raising-bad-type
else:
raise error
......@@ -297,7 +296,7 @@ try:
except pysvn.ClientError, error:
excep = self.getException()
if excep:
raise excep
raise excep # pylint: disable=raising-bad-type
else:
raise error
# XXX: seems that pysvn return a list that is
......@@ -334,7 +333,7 @@ try:
return
excep = self.getException()
if excep:
raise excep
raise excep # pylint: disable=raising-bad-type
else:
raise error
# Edit list to make it more usable in zope
......@@ -365,7 +364,7 @@ try:
except pysvn.ClientError, error:
excep = self.getException()
if excep:
raise excep
raise excep # pylint: disable=raising-bad-type
else:
raise error
if entry is None:
......@@ -387,7 +386,7 @@ try:
return
excep = self.getException()
if excep:
raise excep
raise excep # pylint: disable=raising-bad-type
else:
raise error
#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):
class __metaclass__(ImplicitType):
def __init__(cls, name, bases, d):
ImplicitType.__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) # pylint: disable=non-parent-init-called
if cls.reference:
cls._registry.append((cls.reference, cls))
......@@ -334,6 +334,14 @@ class WorkingCopy(Implicit):
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:
for x in WorkingCopy._registry:
if x[0] == vcs:
......@@ -357,26 +365,26 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder):
self._makeParent(path)
path = os.path.join(self.path, path)
# write file unless unchanged
file = None
file_obj = None
try:
try:
file = open(path, 'r+b')
file_obj = open(path, 'r+b')
except IOError, e:
if e.errno == errno.EISDIR:
shutil.rmtree(path, ignore_errors=True)
elif e.errno != errno.ENOENT:
raise
file = open(path, 'wb')
file_obj = open(path, 'wb')
else:
old_size = os.fstat(file.fileno()).st_size
if len(obj) == old_size and obj == file.read():
old_size = os.fstat(file_obj.fileno()).st_size
if len(obj) == old_size and obj == file_obj.read():
return
file.seek(0)
file.write(obj)
file.truncate()
file_obj.seek(0)
file_obj.write(obj)
file_obj.truncate()
finally:
if file is not None:
file.close()
if file_obj is not None:
file_obj.close()
def _makeParent(self, 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>