diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -2615,6 +2615,12 @@ r = None return author[author.find('<') + 1:r] +_correctauthorformat = re.compile('^[^<]+\s\<[^<>]+@[^<>]+\>$') +def isauthorwellformed(author): + '''Return True if the author field is well formed + (ie "Contributor Name ")''' + return bool(_correctauthorformat.match(author)) + def ellipsis(text, maxlength=400): """Trim string to at most maxlength (default: 400) columns in display.""" return encoding.trim(text, maxlength, ellipsis='...')