changeset 542:c9faba7d01f4

Precompile author file regular expression
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 21 Sep 2012 19:43:50 -0700
parents df1598b722e8
children 5a688ad69449
files hggit/git_handler.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -45,6 +45,8 @@
 RE_NEWLINES = re.compile('[\r\n]')
 RE_GIT_PROGRESS = re.compile('\((\d+)/(\d+)\)')
 
+RE_AUTHOR_FILE = re.compile('\s*=\s*')
+
 class GitProgress(object):
     """convert git server progress strings into mercurial progress"""
     def __init__(self, ui):
@@ -125,7 +127,7 @@
                     line = line.strip()
                     if not line or line.startswith('#'):
                         continue
-                    from_, to = re.split(r'\s*=\s*', line, 2)
+                    from_, to = RE_AUTHOR_FILE.split(line, 2)
                     self.author_map[from_] = to
 
     ## FILE LOAD AND SAVE METHODS