def get_user_name(self, config_file=None): """ Returns user's name from global configuration file. :param config_file: A path to file which should be used to retrieve configuration from (might also be a list of file paths) """ username = self.get_config_value('ui', 'username') if username: return author_name(username) return None
def get_user_name(self, config_file=None): """ Returns user's name from global configuration file. :param config_file: A path to file which should be used to retrieve configuration from (might also be a list of file paths) """ username = self.get_config_value('ui', 'username') if username: return author_name(username) return None
def email_or_none(author): _email = email(author) if _email != '': return _email # See if it contains a username we can get an email from user = User.get_by_username(author_name(author), case_insensitive=True, cache=True) if user is not None: return user.email # No valid email, not a valid user in the system, none! return None
def email_or_none(author): _email = email(author) if _email != '': return _email # See if it contains a username we can get an email from user = User.get_by_username(author_name(author), case_insensitive=True, cache=True) if user is not None: return user.email # No valid email, not a valid user in the system, none! return None
def person(author, show_attr="username_and_name"): # attr to return from fetched user person_getter = lambda usr: getattr(usr, show_attr) # Valid email in the attribute passed, see if they're in the system _email = email(author) if _email != '': user = User.get_by_email(_email, case_insensitive=True, cache=True) if user is not None: return person_getter(user) # Maybe it's a username? _author = author_name(author) user = User.get_by_username(_author, case_insensitive=True, cache=True) if user is not None: return person_getter(user) # Still nothing? Just pass back the author name if any, else the email return _author or _email
def email_or_none(author): # extract email from the commit string _email = email(author) if _email != '': # check it against RhodeCode database, and use the MAIN email for this # user user = User.get_by_email(_email, case_insensitive=True, cache=True) if user is not None: return user.email return _email # See if it contains a username we can get an email from user = User.get_by_username(author_name(author), case_insensitive=True, cache=True) if user is not None: return user.email # No valid email, not a valid user in the system, none! return None
def person(author, show_attr="username_and_name"): # attr to return from fetched user person_getter = lambda usr: getattr(usr, show_attr) # Valid email in the attribute passed, see if they're in the system _email = email(author) if _email != '': user = User.get_by_email(_email, case_insensitive=True, cache=True) if user is not None: return person_getter(user) # Maybe it's a username? _author = author_name(author) user = User.get_by_username(_author, case_insensitive=True, cache=True) if user is not None: return person_getter(user) # Still nothing? Just pass back the author name if any, else the email return _author or _email
def email_or_none(author): # extract email from the commit string _email = email(author) if _email != '': # check it against RhodeCode database, and use the MAIN email for this # user user = User.get_by_email(_email, case_insensitive=True, cache=True) if user is not None: return user.email return _email # See if it contains a username we can get an email from user = User.get_by_username(author_name(author), case_insensitive=True, cache=True) if user is not None: return user.email # No valid email, not a valid user in the system, none! return None
def committer_name(self): """ Returns Author name for given commit """ return author_name(self.committer)
def committer_name(self): """ Returns Author name for given commit """ return author_name(self.committer)
def test_author_name(self): for test_str, result in self.TEST_AUTHORS: self.assertEqual(result[0], author_name(test_str))
def author_name(self): """ Returns author name for this commit """ return author_name(self.author)
def committer_name(self): """ Returns committer name for this commit """ return author_name(self.committer)
def test_author_name(self): for test_str, result in self.TEST_AUTHORS: self.assertEqual(result[0], author_name(test_str))
def author_name(self): """ Returns Author name for given commit """ return author_name(self.author)
def author_name(self): """ Returns Author name for given commit """ return author_name(self.author)
def test_author_name(self, test_str, name, email): assert name == author_name(test_str)