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
+++ b/mercurial/util.py
@@ -690,3 +690,13 @@ def datestr(date=None, format='%c'):
             (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