pull-requests: fixed problems with unicode characters in branches.

This commit is contained in:
Milka Kuzminski 2021-04-08 16:59:58 +02:00
parent 24de12c200
commit 72085d16b0
6 changed files with 11 additions and 10 deletions

View file

@ -311,6 +311,7 @@ class BaseRepository(object):
DEFAULT_CONTACT = u"Unknown"
DEFAULT_DESCRIPTION = u"unknown"
EMPTY_COMMIT_ID = '0' * 40
COMMIT_ID_PAT = re.compile(r'[0-9a-fA-F]{40}')
path = None

View file

@ -618,7 +618,7 @@ class GitRepository(BaseRepository):
else:
output, __ = self.run_git_command(
['merge-base', commit_id1, commit_id2])
ancestor_id = re.findall(r'[0-9a-fA-F]{40}', output)[0]
ancestor_id = self.COMMIT_ID_PAT.findall(output)[0]
log.debug('Found common ancestor with sha: %s', ancestor_id)
@ -642,7 +642,7 @@ class GitRepository(BaseRepository):
'%s..%s' % (commit_id1, commit_id2)])
commits = [
repo1.get_commit(commit_id=commit_id, pre_load=pre_load)
for commit_id in re.findall(r'[0-9a-fA-F]{40}', output)]
for commit_id in self.COMMIT_ID_PAT.findall(output)]
return commits

View file

@ -171,9 +171,9 @@ data = {
<tr>
<td style="padding-right:20px;line-height:20px;">${_('Commit Flow')}:</td>
<td style="line-height:20px;">
<code>${'{}:{}'.format(data['source_ref_type'], pull_request.source_ref_parts.name)}</code> ${_('of')} ${data['source_repo_url']}
<code>${data['source_ref_type']}:${pull_request.source_ref_parts.name}</code> ${_('of')} ${data['source_repo_url']}
&rarr;
<code>${'{}:{}'.format(data['target_ref_type'], pull_request.target_ref_parts.name)}</code> ${_('of')} ${data['target_repo_url']}
<code>${data['target_ref_type']}:${pull_request.target_ref_parts.name}</code> ${_('of')} ${data['target_repo_url']}
</td>
</tr>

View file

@ -124,9 +124,9 @@ data = {
<tr>
<td style="padding-right:20px;line-height:20px;">${_('Commit Flow')}:</td>
<td style="line-height:20px;">
<code>${'{}:{}'.format(data['source_ref_type'], pull_request.source_ref_parts.name)}</code> ${_('of')} ${data['source_repo_url']}
<code>${data['source_ref_type']}:${pull_request.source_ref_parts.name}</code> ${_('of')} ${data['source_repo_url']}
&rarr;
<code>${'{}:{}'.format(data['target_ref_type'], pull_request.target_ref_parts.name)}</code> ${_('of')} ${data['target_repo_url']}
<code>${data['target_ref_type']}:${pull_request.target_ref_parts.name}</code> ${_('of')} ${data['target_repo_url']}
</td>
</tr>

View file

@ -129,9 +129,9 @@ data = {
<tr>
<td style="padding-right:20px;line-height:20px;">${_('Commit Flow')}:</td>
<td style="line-height:20px;">
<code>${'{}:{}'.format(data['source_ref_type'], pull_request.source_ref_parts.name)}</code> ${_('of')} ${data['source_repo_url']}
<code>${data['source_ref_type']}:${pull_request.source_ref_parts.name}</code> ${_('of')} ${data['source_repo_url']}
&rarr;
<code>${'{}:{}'.format(data['target_ref_type'], pull_request.target_ref_parts.name)}</code> ${_('of')} ${data['target_repo_url']}
<code>${data['target_ref_type']}:${pull_request.target_ref_parts.name}</code> ${_('of')} ${data['target_repo_url']}
</td>
</tr>

View file

@ -143,9 +143,9 @@
## pull url
<li>
%if h.is_hg(c.pull_request.source_repo):
<% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
<% clone_url = u'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
%elif h.is_git(c.pull_request.source_repo):
<% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
<% clone_url = u'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
%endif
<span>${_('Pull changes from source')}</span>: <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">