comparison hgext3rd/topic/__init__.py @ 3371:753e5ebabe7d

topics: take logic to parse username to a separate function In next patch we will be adding support to `hg stack` to show users, and this logic will be required there too. So let's take it out in a separate function.
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 27 Dec 2017 23:51:18 +0530
parents 4d7e002a2bb5
children 4138771105bb
comparison
equal deleted inserted replaced
3370:1face8964965 3371:753e5ebabe7d
1007 rt = marker.date() 1007 rt = marker.date()
1008 if rt[0] > maxtime[0]: 1008 if rt[0] > maxtime[0]:
1009 user = marker.metadata().get('user', user) 1009 user = marker.metadata().get('user', user)
1010 maxtime = rt 1010 maxtime = rt
1011 1011
1012 # Making the username more better 1012 username = stack.parseusername(user)
1013 username = None
1014 if user:
1015 # user is of form "abc <abc@xyz.com>"
1016 username = user.split('<')[0]
1017 if not username:
1018 # user is of form "<abc@xyz.com>"
1019 username = user[1:-1]
1020 username = username.strip()
1021
1022 topicuser = (t, username) 1013 topicuser = (t, username)
1023 1014
1024 if trevs: 1015 if trevs:
1025 secspassed = (curtime - maxtime[0]) 1016 secspassed = (curtime - maxtime[0])
1026 try: 1017 try: