示例#1
0
    def test_constructor(self):
        r1 = Repo.init(self.path, mkdir=True)

        # verify that an existing repository can be initialized
        r2 = Repo(r1.root)

        # make sure it's a Repo object.
        assert type(r2) is Repo

        # a new repo should have no HEAD
        try:
            r2.head()
        except NoHeadSet:
            pass
示例#2
0
    def __init__(self, path):
        if not os.path.exists(path):
            path = match_path(path)
            if path is None:
                raise OSError('Supplied path does not exist')

        # remove trailing slash
        if path.endswith('/'):
            path = path[:-1]

        self.path = path
        self.paths = {
            'root': self.path,
            'base': os.path.basename(self.path),
            'config': os.path.join(self.path, 'config'),
            'issues': os.path.join(self.path, 'issues'),
            'admin': os.path.join(self.path, '.hopper'),
            'docs': os.path.join(self.path, 'docs')
        }
        self.properties = {'name': None}
        self.repo = Repo(path)
        self.config = TrackerConfig(self)
        self.db = Database(self)