Esempio n. 1
0
def fixup_user(user,authors):
  user=user.strip("\"")
  if authors!=None:
    # if we have an authors table, try to get mapping
    # by defaulting to the current value of 'user'
    user=authors.get(user,user)
  name,mail,m='','',user_re.match(user)
  if m==None:
    # if we don't have 'Name <mail>' syntax, extract name
    # and mail from hg helpers. this seems to work pretty well.
    # if email doesn't contain @, replace it with devnull@localhost
    name=templatefilters.person(user)
    mail='<%s>' % templatefilters.email(user)
    if '@' not in mail:
      mail = '<devnull@localhost>'
  else:
    # if we have 'Name <mail>' syntax, everything is fine :)
    name,mail=m.group(1),m.group(2)

  # remove any silly quoting from username
  m2=user_clean_re.match(name)
  if m2!=None:
    name=m2.group(1)
  return '%s %s' % (name,mail)
Esempio n. 2
0
def fixup_user(user, authors):
    user = user.strip("\"")
    if authors != None:
        # if we have an authors table, try to get mapping
        # by defaulting to the current value of 'user'
        user = authors.get(user, user)
    name, mail, m = '', '', user_re.match(user)
    if m == None:
        # if we don't have 'Name <mail>' syntax, extract name
        # and mail from hg helpers. this seems to work pretty well.
        # if email doesn't contain @, replace it with devnull@localhost
        name = templatefilters.person(user)
        mail = '<%s>' % templatefilters.email(user)
        if '@' not in mail:
            mail = '<devnull@localhost>'
    else:
        # if we have 'Name <mail>' syntax, everything is fine :)
        name, mail = m.group(1), m.group(2)

    # remove any silly quoting from username
    m2 = user_clean_re.match(name)
    if m2 != None:
        name = m2.group(1)
    return '%s %s' % (name, mail)