Mercurial > public > mercurial-scm > hg-stable
diff mercurial/ui.py @ 1129:ee4f60abad93
Move generating short username to display in hg/hgweb annotate to ui module.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 28 Aug 2005 17:29:28 +0200 |
parents | 8f0ac653f85e |
children | d32b91ebad5d |
line wrap: on
line diff
--- a/mercurial/ui.py Sun Aug 28 16:41:16 2005 +0200 +++ b/mercurial/ui.py Sun Aug 28 17:29:28 2005 +0200 @@ -78,6 +78,16 @@ os.environ.get("USERNAME", "unknown")) + '@' + socket.getfqdn())) + def shortuser(self, 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 + def expandpath(self, loc): paths = {} for name, path in self.configitems("paths"):