comparison sat/plugins/plugin_merge_req_mercurial.py @ 2621:2f75830a8228

plugin merge request (mercurial): escape colons in import name
author Goffi <goffi@goffi.org>
date Wed, 27 Jun 2018 07:23:59 +0200
parents 72f6f37ab648
children 49533de4540b
comparison
equal deleted inserted replaced
2620:72f6f37ab648 2621:2f75830a8228
130 130
131 def import_(self, repository, data, data_type, item_id, service, node, extra): 131 def import_(self, repository, data, data_type, item_id, service, node, extra):
132 parsed_data = self.parse(data) 132 parsed_data = self.parse(data)
133 try: 133 try:
134 parsed_name = parsed_data[0][u'commit_msg'].split(u'\n')[0] 134 parsed_name = parsed_data[0][u'commit_msg'].split(u'\n')[0]
135 parsed_name = re.sub(ur'[^\w -.]', u'', parsed_name, flags=re.UNICODE)[:40] 135 parsed_name = re.sub(ur'[^\w -.:]', u'', parsed_name, flags=re.UNICODE)[:40]
136 except Exception: 136 except Exception:
137 parsed_name = u'' 137 parsed_name = u''
138 name = u'mr_{item_id}_{parsed_name}'.format(item_id=item_id, 138 name = u'mr_{item_id}_{parsed_name}'.format(item_id=item_id,
139 parsed_name=parsed_name) 139 parsed_name=parsed_name)
140 return MercurialProtocol.run(repository, 'qimport', '-g', '--name', name, 140 return MercurialProtocol.run(repository, 'qimport', '-g', '--name', name,