flash = _Flash() #============================================================================== # SCM FILTERS available via h. #============================================================================== from rhodecode.lib.vcs.utils import author_name, author_email from rhodecode.lib.utils2 import credentials_filter, age as _age from rhodecode.model.db import User age = lambda x: _age(x) capitalize = lambda x: x.capitalize() email = author_email short_id = lambda x: x[:12] hide_credentials = lambda x: ''.join(credentials_filter(x)) def is_git(repository): if hasattr(repository, 'alias'): _type = repository.alias elif hasattr(repository, 'repo_type'): _type = repository.repo_type else: _type = repository return _type == 'git' def is_hg(repository): if hasattr(repository, 'alias'): _type = repository.alias
def test_credentials_filter(self): from rhodecode.lib.utils2 import credentials_filter for url in TEST_URLS: self.assertEqual(credentials_filter(url[0]), url[2])
def test_credentials_filter(self, test_url, expected, expected_creds): from rhodecode.lib.utils2 import credentials_filter self.assertEqual(credentials_filter(test_url), expected_creds)
return [_Message(*m) for m in messages] flash = Flash() #============================================================================== # SCM FILTERS available via h. #============================================================================== from rhodecode.lib.vcs.utils import author_name, author_email from rhodecode.lib.utils2 import credentials_filter, age as _age from rhodecode.model.db import User, ChangesetStatus age = lambda x, y=False: _age(x, y) capitalize = lambda x: x.capitalize() email = author_email short_id = lambda x: x[:12] hide_credentials = lambda x: ''.join(credentials_filter(x)) def show_id(cs): """ Configurable function that shows ID by default it's r123:fffeeefffeee :param cs: changeset instance """ from rhodecode import CONFIG def_len = safe_int(CONFIG.get('show_sha_length', 12)) show_rev = str2bool(CONFIG.get('show_revision_number', True)) raw_id = cs.raw_id[:def_len] if show_rev: