Commits

Gregory Szorc  committed c9faba7

Precompile author file regular expression

  • Participants
  • Parent commits df1598b

Comments (0)

Files changed (1)

File hggit/git_handler.py

 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):
                     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