changeset 1903:e4abeafd6eb1

move shortuser into util module.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Mon, 27 Feb 2006 11:32:10 -0800
parents 1cc5f25653a3
children a7e416bf3c1d
files mercurial/ui.py mercurial/util.py
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Mon Feb 27 11:18:56 2006 -0800
+++ b/mercurial/ui.py	Mon Feb 27 11:32:10 2006 -0800
@@ -104,13 +104,7 @@
 
     def shortuser(self, user):
         """Return a short representation of a user name or email address."""
-        if not self.verbose:
-            f = user.find('@')
-            if f >= 0:
-                user = user[:f]
-            f = user.find('<')
-            if f >= 0:
-                user = user[f+1:]
+        if not self.verbose: user = util.shortuser(user)
         return user
 
     def expandpath(self, loc, root=""):
--- 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