Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 1903:e4abeafd6eb1
move shortuser into util module.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Mon, 27 Feb 2006 11:32:10 -0800 |
parents | ae61937c61c5 |
children | b7cc0f323a4c |
line wrap: on
line diff
--- a/mercurial/util.py Mon Feb 27 11:18:56 2006 -0800 +++ b/mercurial/util.py Mon Feb 27 11:32:10 2006 -0800 @@ -690,3 +690,13 @@ (time.strftime(format, time.gmtime(float(t) - tz)), -tz / 3600, ((-tz % 3600) / 60))) + +def shortuser(user): + """Return a short representation of a user name or email address.""" + f = user.find('@') + if f >= 0: + user = user[:f] + f = user.find('<') + if f >= 0: + user = user[f+1:] + return user