def __init__(self, repo_path, create=False, src_url=None, update_after_clone=False, bare=False): self.path = abspath(repo_path) self._repo = self._get_repo(create, src_url, update_after_clone, bare) #temporary set that to now at later we will move it to constructor baseui = None if baseui is None: from mercurial.ui import ui baseui = ui() # patch the instance of GitRepo with an "FAKE" ui object to add # compatibility layer with Mercurial setattr(self._repo, 'ui', baseui) try: self.head = self._repo.head() except KeyError: self.head = None self._config_files = [ bare and abspath(self.path, 'config') or abspath(self.path, '.git', 'config'), abspath(get_user_home(), '.gitconfig'), ] self.bare = self._repo.bare
def __init__(self, repo_path, create=False, src_url=None, update_after_clone=False, bare=False): self.path = abspath(repo_path) self._repo = self._get_repo(create, src_url, update_after_clone, bare) #temporary set that to now at later we will move it to constructor baseui = None if baseui is None: from mercurial.ui import ui baseui = ui() # patch the instance of GitRepo with an "FAKE" ui object to add # compatibility layer with Mercurial setattr(self._repo, 'ui', baseui) try: self.head = self._repo.head() except KeyError: self.head = None self._config_files = [ bare and abspath(self.path, 'config') or abspath(self.path, '.git', 'config'), abspath(get_user_home(), '.gitconfig'), ]
def __init__(self, repo_path, create=False, src_url=None, update_after_clone=False, bare=False): self.path = abspath(repo_path) repo = self._get_repo(create, src_url, update_after_clone, bare) self.bare = repo.bare self._config_files = [ bare and abspath(self.path, "config") or abspath(self.path, ".git", "config"), abspath(get_user_home(), ".gitconfig"), ]
def __init__(self, repo_path, create=False, src_url=None, update_after_clone=False, bare=False): self.path = abspath(repo_path) repo = self._get_repo(create, src_url, update_after_clone, bare) self.bare = repo.bare self._config_files = [ bare and abspath(self.path, 'config') or abspath(self.path, '.git', 'config'), abspath(get_user_home(), '.gitconfig'), ]
def _config_files(self): return [ self.bare and abspath(self.path, 'config') or abspath(self.path, '.git', 'config'), abspath(get_user_home(), '.gitconfig'), ]
def test_prefers_home_over_userprofile(self): self.assertEqual(get_user_home(), '/home/foobar')
def test_windows_like(self): self.assertEqual(get_user_home(), '/Users/foobar')
def test_unix_like(self): self.assertEqual(get_user_home(), '/home/foobar')
def test_defaults_to_none(self): self.assertEqual(get_user_home(), '')
import os import tempfile from rhodecode.lib.vcs.utils.paths import get_user_home abspath = lambda * p: os.path.abspath(os.path.join(*p)) VCSRC_PATH = os.environ.get('VCSRC_PATH') if not VCSRC_PATH: HOME_ = get_user_home() if not HOME_: HOME_ = tempfile.gettempdir() VCSRC_PATH = VCSRC_PATH or abspath(HOME_, '.vcsrc') if os.path.isdir(VCSRC_PATH): VCSRC_PATH = os.path.join(VCSRC_PATH, '__init__.py') BACKENDS = { 'hg': 'vcs.backends.hg.MercurialRepository', 'git': 'vcs.backends.git.GitRepository', } ARCHIVE_SPECS = { 'tar': ('application/x-tar', '.tar'), 'tbz2': ('application/x-bzip2', '.tar.bz2'), 'tgz': ('application/x-gzip', '.tar.gz'), 'zip': ('application/zip', '.zip'), } BACKENDS = { 'hg': 'rhodecode.lib.vcs.backends.hg.MercurialRepository',
import os import tempfile from rhodecode.lib.vcs.utils.paths import get_user_home abspath = lambda *p: os.path.abspath(os.path.join(*p)) VCSRC_PATH = os.environ.get('VCSRC_PATH') if not VCSRC_PATH: HOME_ = get_user_home() if not HOME_: HOME_ = tempfile.gettempdir() VCSRC_PATH = VCSRC_PATH or abspath(HOME_, '.vcsrc') if os.path.isdir(VCSRC_PATH): VCSRC_PATH = os.path.join(VCSRC_PATH, '__init__.py') BACKENDS = { 'hg': 'vcs.backends.hg.MercurialRepository', 'git': 'vcs.backends.git.GitRepository', } ARCHIVE_SPECS = { 'tar': ('application/x-tar', '.tar'), 'tbz2': ('application/x-bzip2', '.tar.bz2'), 'tgz': ('application/x-gzip', '.tar.gz'), 'zip': ('application/zip', '.zip'), } BACKENDS = { 'hg': 'rhodecode.lib.vcs.backends.hg.MercurialRepository',