Commit 8e5b7149 authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

forge: pylint py3

parent 4287d684
# TODO: this module was not ported to python3, it's not clear if this
# is still useful
# pylint:disable=import-error
import compiler import compiler
import compiler.ast import compiler.ast
import compiler.visitor import compiler.visitor
......
...@@ -41,7 +41,7 @@ GIT_ASKPASS = os.path.join(Products.ERP5.product_path, 'bin', 'git_askpass') ...@@ -41,7 +41,7 @@ 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"""
pass
class GitError(EnvironmentError): class GitError(EnvironmentError):
def __init__(self, err, out, returncode): def __init__(self, err, out, returncode):
...@@ -240,7 +240,7 @@ class Git(WorkingCopy): ...@@ -240,7 +240,7 @@ class Git(WorkingCopy):
node_dict[parent] = [path] node_dict[parent] = [path]
path_dict[parent] = status path_dict[parent] = status
if parent: if parent:
path_list.append(parent) path_list.append(parent) # pylint:disable=modified-iterating-list
else: else:
while path_dict.get(parent, status) != status: while path_dict.get(parent, status) != status:
path_dict[parent] = status = '*' path_dict[parent] = status = '*'
...@@ -265,7 +265,7 @@ class Git(WorkingCopy): ...@@ -265,7 +265,7 @@ class Git(WorkingCopy):
else: else:
child = Dir(basename, dir_status(status)) child = Dir(basename, dir_status(status))
node.sub_dirs.append(child) node.sub_dirs.append(child)
path_list.append((content, child)) path_list.append((content, child)) # pylint:disable=modified-iterating-list
return (root.sub_dirs or root.sub_files) and root return (root.sub_dirs or root.sub_files) and root
def update(self, keep=False): def update(self, keep=False):
...@@ -275,7 +275,7 @@ class Git(WorkingCopy): ...@@ -275,7 +275,7 @@ class Git(WorkingCopy):
if not keep: if not keep:
self.clean() self.clean()
self.remote_git('pull', '--ff-only') self.remote_git('pull', '--ff-only')
elif 1: # elif local_changes: elif 1: # elif local_changes: # pylint:disable=using-constant-test
raise NotImplementedError raise NotImplementedError
# addremove # addremove
# write-tree | commit-tree -> A # write-tree | commit-tree -> A
...@@ -363,16 +363,15 @@ class Git(WorkingCopy): ...@@ -363,16 +363,15 @@ class Git(WorkingCopy):
raise raise
# try to update our working copy # try to update our working copy
# TODO: find a solution if there are other local changes # TODO: find a solution if there are other local changes
# TODO: solve conflicts on */bt/revision automatically
try: try:
self.git(merge, '@{u}', env=env) self.git(merge, '@{u}', env=env)
except GitError as e: except GitError as e2:
# XXX: how to know how it failed ? # XXX: how to know how it failed ?
try: try:
self.git(merge, '--abort') self.git(merge, '--abort')
except GitError: except GitError:
pass pass
raise e raise e2
# no need to keep a merge commit if push fails again # no need to keep a merge commit if push fails again
if merge == 'merge': if merge == 'merge':
reset += 1 reset += 1
......
...@@ -41,6 +41,7 @@ from AccessControl import ClassSecurityInfo ...@@ -41,6 +41,7 @@ from AccessControl import ClassSecurityInfo
from AccessControl.SecurityInfo import ModuleSecurityInfo from AccessControl.SecurityInfo import ModuleSecurityInfo
from tempfile import mkdtemp from tempfile import mkdtemp
import shutil import shutil
import six
class getTransactionalDirectory(str): class getTransactionalDirectory(str):
...@@ -63,17 +64,14 @@ class getTransactionalDirectory(str): ...@@ -63,17 +64,14 @@ class getTransactionalDirectory(str):
class SubversionError(Exception): class SubversionError(Exception):
"""The base exception class for the Subversion interface. """The base exception class for the Subversion interface.
""" """
pass
class SubversionInstallationError(SubversionError): class SubversionInstallationError(SubversionError):
"""Raised when an installation is broken. """Raised when an installation is broken.
""" """
pass
class SubversionTimeoutError(SubversionError): class SubversionTimeoutError(SubversionError):
"""Raised when a Subversion transaction is too long. """Raised when a Subversion transaction is too long.
""" """
pass
class SubversionLoginError(SubversionError): class SubversionLoginError(SubversionError):
"""Raised when an authentication is required. """Raised when an authentication is required.
...@@ -140,9 +138,9 @@ try: ...@@ -140,9 +138,9 @@ try:
self.client.setException(SubversionLoginError(realm)) self.client.setException(SubversionLoginError(realm))
return False, '', '', False return False, '', '', False
# BBB. support older versions of pysvn <= 1.6.3 # BBB. support older versions of pysvn <= 1.6.3
if isinstance(user, unicode): if six.PY2 and isinstance(user, six.text_type):
user = user.encode('utf-8') user = user.encode('utf-8')
if isinstance(password, unicode): if six.PY2 and isinstance(password, six.text_type):
password = password.encode('utf-8') password = password.encode('utf-8')
return True, user, password, False return True, user, password, False
...@@ -178,7 +176,7 @@ try: ...@@ -178,7 +176,7 @@ try:
def __call__(self, instance): def __call__(self, instance):
value = getattr(instance._obj, self._key) value = getattr(instance._obj, self._key)
if isinstance(value, unicode): if six.PY2 and isinstance(value, six.text_type):
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'>":
......
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