diff mercurial/util.py @ 5975:75d9fe70c654

templater: move email function to util
author Matt Mackall <mpm@selenic.com>
date Thu, 31 Jan 2008 14:44:19 -0600
parents 48d01b1e315f
children 3c9dbb743d20
line wrap: on
line diff
--- a/mercurial/util.py	Thu Jan 31 14:44:19 2008 -0600
+++ b/mercurial/util.py	Thu Jan 31 14:44:19 2008 -0600
@@ -1636,6 +1636,12 @@
         user = user[:f]
     return user
 
+def email(author):
+    '''get email of author.'''
+    r = author.find('>')
+    if r == -1: r = None
+    return author[author.find('<')+1:r]
+
 def ellipsis(text, maxlength=400):
     """Trim string to at most maxlength (default: 400) characters."""
     if len(text) <= maxlength: