plugin merge-request mercurial: better name sanitization for import
This commit is contained in:
parent
2b44df2294
commit
b1b765fcc0
1 changed files with 2 additions and 1 deletions
|
|
@ -23,6 +23,7 @@ from sat.core import exceptions
|
|||
from twisted.internet import reactor, defer, protocol
|
||||
from twisted.python.failure import Failure
|
||||
from twisted.python.procutils import which
|
||||
import re
|
||||
from sat.core.log import getLogger
|
||||
log = getLogger(__name__)
|
||||
|
||||
|
|
@ -130,7 +131,7 @@ class MercurialHandler(object):
|
|||
parsed_data = self.parse(data)
|
||||
try:
|
||||
parsed_name = parsed_data[0][u'commit_msg'].split(u'\n')[0]
|
||||
parsed_name = parsed_name.replace(u' ', u'_')[:20]
|
||||
parsed_name = re.sub(ur'[^\w-]', u'', parsed_name, flags=re.UNICODE)[:20]
|
||||
except Exception:
|
||||
parsed_name = u''
|
||||
name = u'mr_{item_id}_{parsed_name}'.format(item_id=item_id, parsed_name=parsed_name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue