# Path: vilya/core.py
# class VilyaError(Exception):
# class VilyaFormError(Exception):
# class Service(object):
#     def __init__(self, msg):
#     def __init__(self, errors=None):
#     def _isinstance(self, model, raise_error=True):
#     def _preprocess_params(self, kwargs):
#     def save(self, model):
#     def all(self):
#     def get(self, id):
#     def get_all(self, *ids):
#     def find(self, **kwargs):
#     def first(self, **kwargs):
#     def get_or_404(self, id):
#     def new(self, **kwargs):
#     def create(self, **kwargs):
#     def update(self, model, **kwargs):
#     def delete(self, model):
#     def transaction(cls, func):
#         def transaction_block(*args, **kwargs):
# 
# Path: vilya/projects/repository.py
# class ProjectRepository(Repository):
# 
#     def __init__(self, project):
#         path = os.path.join(REPO_ROOT_PATH, project.path)
#         self.project = project
#         super(ProjectRepository, self).__init__(path)
# 
#     @classmethod
#     def init(self, path, bare=True):
#         path = os.path.join(REPO_ROOT_PATH, path)
#         super(ProjectRepository, self).init(path, bare=bare)
# 
#     def get_commit(self, reference):
#         pass
# 
#     def get_readme(self, reference='HEAD', path=None):
#         entries = self.repository.list_entries(reference=reference,
#                                                path=path)
#         for path in entries:
#             entry = entries[path]
#             if (entry.is_blob and entry.name == 'README' or entry.name.startswith('README.')):
#                 readme_content = self.get_file(reference, path)
#                 return format_md_or_rst(path, readme_content)
#         return ''
# 
#     def get_rendered_file(self, reference='HEAD', path=None):
#         content = self.get_file(reference=reference, path=path)
#         if content:
#             return format_md_or_rst(path, content)
# 
#     def fork(self, path):
#         path = os.path.join(REPO_ROOT_PATH, path)
#         return self.repository.clone_to(path, bare=True)
# 
#     def list_commits(self, *k, **kw):
#         commits = super(ProjectRepository, self).list_commits(*k, **kw)
#         return [Commit(c) for c in commits]
# 
#     def resolve_commit(self, *k, **kw):
#         commit = super(ProjectRepository, self).resolve_commit(*k, **kw)
#         return Commit(commit) if commit else None


from datetime import datetime
from ..core import db
from .repository import ProjectRepository
from sqlalchemy import event
        from ..services import users
        from ..services import users
        from ..services import issues
        from ..services import pullrequests
        from ..services import projects
# -*- coding: utf-8 -*-



class Project(db.Model):
    __tablename__ = 'projects'

    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(200))
    description = db.Column(db.String(1024))
    upstream_id = db.Column(db.Integer)
    family_id = db.Column(db.Integer)

# Path: vilya/core.py
# class VilyaError(Exception):
# class VilyaFormError(Exception):
# class Service(object):
#     def __init__(self, msg):
#     def __init__(self, errors=None):
#     def _isinstance(self, model, raise_error=True):
#     def _preprocess_params(self, kwargs):
#     def save(self, model):
#     def all(self):
#     def get(self, id):
#     def get_all(self, *ids):
#     def find(self, **kwargs):
#     def first(self, **kwargs):
#     def get_or_404(self, id):
#     def new(self, **kwargs):
#     def create(self, **kwargs):
#     def update(self, model, **kwargs):
#     def delete(self, model):
#     def transaction(cls, func):
#         def transaction_block(*args, **kwargs):
# 
# Path: vilya/projects/repository.py
# class ProjectRepository(Repository):
# 
#     def __init__(self, project):
#         path = os.path.join(REPO_ROOT_PATH, project.path)
#         self.project = project
#         super(ProjectRepository, self).__init__(path)
# 
#     @classmethod
#     def init(self, path, bare=True):
#         path = os.path.join(REPO_ROOT_PATH, path)
#         super(ProjectRepository, self).init(path, bare=bare)
# 
#     def get_commit(self, reference):
#         pass
# 
#     def get_readme(self, reference='HEAD', path=None):
#         entries = self.repository.list_entries(reference=reference,
#                                                path=path)
#         for path in entries:
#             entry = entries[path]
#             if (entry.is_blob and entry.name == 'README' or entry.name.startswith('README.')):
#                 readme_content = self.get_file(reference, path)
#                 return format_md_or_rst(path, readme_content)
#         return ''
# 
#     def get_rendered_file(self, reference='HEAD', path=None):
#         content = self.get_file(reference=reference, path=path)
#         if content:
#             return format_md_or_rst(path, content)
# 
#     def fork(self, path):
#         path = os.path.join(REPO_ROOT_PATH, path)
#         return self.repository.clone_to(path, bare=True)
# 
#     def list_commits(self, *k, **kw):
#         commits = super(ProjectRepository, self).list_commits(*k, **kw)
#         return [Commit(c) for c in commits]
# 
#     def resolve_commit(self, *k, **kw):
#         commit = super(ProjectRepository, self).resolve_commit(*k, **kw)
#         return Commit(commit) if commit else None


# Path: vilya/projects/models.py
from datetime import datetime
from ..core import db
from .repository import ProjectRepository
from sqlalchemy import event
        from ..services import users
        from ..services import users
        from ..services import issues
        from ..services import pullrequests
        from ..services import projects

# -*- coding: utf-8 -*-



class Project(db.Model):
    __tablename__ = 'projects'

    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(200))
    description = db.Column(db.String(1024))
    upstream_id = db.Column(db.Integer)
    family_id = db.Column(db.Integer)

    owner_id = db.Column(db.Integer)