core: some more line limiting
This commit is contained in:
parent
8432630146
commit
ea9583aea0
2 changed files with 27 additions and 15 deletions
|
|
@ -71,15 +71,14 @@ class MercurialProtocol(protocol.ProcessProtocol):
|
|||
log.debug(_('Mercurial command succeed'))
|
||||
self._deferred.callback(data)
|
||||
else:
|
||||
msg = _(u"Can't complete Mercurial command (error code: {code}): {message}").format(
|
||||
code = reason.value.exitCode,
|
||||
message = data)
|
||||
msg = (_(u"Can't complete Mercurial command (error code: {code}): {message}")
|
||||
.format(code = reason.value.exitCode, message = data))
|
||||
log.warning(msg)
|
||||
self._deferred.errback(Failure(RuntimeError(msg)))
|
||||
|
||||
@classmethod
|
||||
def run(cls, path, command, *args, **kwargs):
|
||||
"""Create a new MercurialRegisterProtocol and execute the given mercurialctl command.
|
||||
"""Create a new MercurialRegisterProtocol and execute the given mercurial command.
|
||||
|
||||
@param path(unicode): path to the repository
|
||||
@param command(unicode): command to run
|
||||
|
|
@ -113,7 +112,8 @@ class MercurialHandler(object):
|
|||
try:
|
||||
MercurialProtocol.hg = which('hg')[0]
|
||||
except IndexError:
|
||||
raise exceptions.NotFound(_(u"Mercurial executable (hg) not found, can't use Mercurial handler"))
|
||||
raise exceptions.NotFound(_(u"Mercurial executable (hg) not found, "
|
||||
u"can't use Mercurial handler"))
|
||||
self.host = host
|
||||
self._m = host.plugins['MERGE_REQUESTS']
|
||||
self._m.register('mercurial', self, self.data_types, SHORT_DESC)
|
||||
|
|
@ -125,7 +125,8 @@ class MercurialHandler(object):
|
|||
return d
|
||||
|
||||
def export(self, repository):
|
||||
return MercurialProtocol.run(repository, 'export', '-g', '-r', 'outgoing()', '--encoding=utf-8')
|
||||
return MercurialProtocol.run(repository, 'export', '-g', '-r', 'outgoing()',
|
||||
'--encoding=utf-8')
|
||||
|
||||
def import_(self, repository, data, data_type, item_id, service, node, extra):
|
||||
parsed_data = self.parse(data)
|
||||
|
|
@ -134,8 +135,10 @@ class MercurialHandler(object):
|
|||
parsed_name = re.sub(ur'[^\w -.]', u'', parsed_name, flags=re.UNICODE)[:40]
|
||||
except Exception:
|
||||
parsed_name = u''
|
||||
name = u'mr_{item_id}_{parsed_name}'.format(item_id=item_id, parsed_name=parsed_name)
|
||||
return MercurialProtocol.run(repository, 'qimport', '-g', '--name', name, '--encoding=utf-8', '-', stdin=data)
|
||||
name = u'mr_{item_id}_{parsed_name}'.format(item_id=item_id,
|
||||
parsed_name=parsed_name)
|
||||
return MercurialProtocol.run(repository, 'qimport', '-g', '--name', name,
|
||||
'--encoding=utf-8', '-', stdin=data)
|
||||
|
||||
def parse(self, data, data_type=None):
|
||||
lines = data.splitlines()
|
||||
|
|
@ -160,15 +163,18 @@ class MercurialHandler(object):
|
|||
if not elems:
|
||||
continue
|
||||
last = elems[-1]
|
||||
if last.startswith(u'<') and last.endswith(u'>') and u'@' in last:
|
||||
if (last.startswith(u'<') and last.endswith(u'>')
|
||||
and u'@' in last):
|
||||
patch[self._m.META_EMAIL] = elems.pop()[1:-1]
|
||||
patch[self._m.META_AUTHOR] = u' '.join(elems)
|
||||
elif line.startswith(u'# Date '):
|
||||
time_data = line[7:].split()
|
||||
if len(time_data) != 2:
|
||||
log.warning(_(u'unexpected time data: {data}').format(data=line[7:]))
|
||||
log.warning(_(u'unexpected time data: {data}')
|
||||
.format(data=line[7:]))
|
||||
continue
|
||||
patch[self._m.META_TIMESTAMP] = int(time_data[0]) + int(time_data[1])
|
||||
patch[self._m.META_TIMESTAMP] = (int(time_data[0])
|
||||
+ int(time_data[1]))
|
||||
elif line.startswith(u'# Node ID '):
|
||||
patch[self._m.META_HASH] = line[10:]
|
||||
elif line.startswith(u'# Parent '):
|
||||
|
|
|
|||
14
setup.py
14
setup.py
|
|
@ -77,19 +77,25 @@ def sat_dev_version():
|
|||
setup(name=NAME,
|
||||
version=VERSION,
|
||||
description=u'Salut à Toi multipurpose and multi frontend XMPP client',
|
||||
long_description=u'Salut à Toi (SàT) is a XMPP client based on a daemon/frontend architecture. Its multi frontend (desktop, web, console interface, CLI, etc) and multipurpose (instant messaging, microblogging, games, file sharing, etc).',
|
||||
long_description=u'Salut à Toi (SàT) is a XMPP client based on a daemon/frontend '
|
||||
u'architecture. Its multi frontend (desktop, web, console '
|
||||
u'interface, CLI, etc) and multipurpose (instant messaging, '
|
||||
u'microblogging, games, file sharing, etc).',
|
||||
author='Association « Salut à Toi »',
|
||||
author_email='contact@goffi.org',
|
||||
url='https://salut-a-toi.org',
|
||||
classifiers=['Development Status :: 3 - Alpha',
|
||||
'Environment :: Console',
|
||||
'Framework :: Twisted',
|
||||
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
|
||||
'License :: OSI Approved :: GNU Affero General Public License v3 '
|
||||
'or later (AGPLv3+)',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Topic :: Communications :: Chat'],
|
||||
packages=find_packages() + ['twisted.plugins'],
|
||||
data_files=[(os.path.join(sys.prefix, 'share/locale/fr/LC_MESSAGES'), ['i18n/fr/LC_MESSAGES/sat.mo']),
|
||||
(os.path.join('share/doc', NAME), ['CHANGELOG', 'COPYING', 'INSTALL', 'README', 'README4TRANSLATORS']),
|
||||
data_files=[(os.path.join(sys.prefix, 'share/locale/fr/LC_MESSAGES'),
|
||||
['i18n/fr/LC_MESSAGES/sat.mo']),
|
||||
(os.path.join('share/doc', NAME),
|
||||
['CHANGELOG', 'COPYING', 'INSTALL', 'README', 'README4TRANSLATORS']),
|
||||
(os.path.join('share', DBUS_DIR), [DBUS_FILE]),
|
||||
],
|
||||
scripts=['sat_frontends/jp/jp', 'sat_frontends/primitivus/primitivus', 'bin/sat'],
|
||||
|
|
|
|||
Loading…
Reference in a new issue