changeset 1903 | e4abeafd6eb1 |
parent 1635 | ae61937c61c5 |
child 1920 | b7cc0f323a4c |
--- 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