Skip to content
Snippets Groups Projects
Commit 6e05aa1b authored by Gregory Szorc's avatar Gregory Szorc
Browse files

Optimize get_git_author

Pre-compile regular expression. Prevent extra key lookup in author_map.
parent 3b82cf6a
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,8 @@
import util
from overlay import overlayrepo
RE_GIT_AUTHOR = re.compile('^(.*?) ?\<(.*?)(?:\>(.*))?$')
class GitProgress(object):
"""convert git server progress strings into mercurial progress"""
def __init__(self, ui):
......@@ -433,7 +435,6 @@
author = ctx.user()
# see if a translation exists
if author in self.author_map:
author = self.author_map[author]
author = self.author_map.get(author, author)
# check for git author pattern compliance
......@@ -438,7 +439,6 @@
# check for git author pattern compliance
regex = re.compile('^(.*?) ?\<(.*?)(?:\>(.*))?$')
a = regex.match(author)
a = RE_GIT_AUTHOR.match(author)
if a:
name = self.get_valid_git_username_email(a.group(1))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment