# Path: checkmate/contrib/plugins/git/models.py
# class GitSnapshot(BaseDocument):
# 
#     """
#     """
# 
#     project = ForeignKeyField('Project',unique = False,backref = 'git_snapshots')
#     snapshot = ForeignKeyField('Snapshot',unique = True,backref = 'git_snapshot')
#     sha = CharField(indexed = True,length = 40)
#     hash = CharField(indexed = True,length = 64)
#     committer_date = DateTimeField(indexed = True)
#     author_date = DateTimeField(indexed = True)
#     author_name = CharField(length = 100)
#     committer_date_ts = IntegerField(indexed = True)
#     author_date_ts = IntegerField(indexed = True)
#     tree_sha = CharField(indexed = True,length = 40)
#     log = TextField(indexed = False)
# 
#     class Meta(BaseDocument.Meta):
# 
#         unique_together = [('project','sha')]
# 
# class GitBranch(BaseDocument):
# 
#     project = ForeignKeyField('Project',backref = 'git_branches')
#     name = CharField(indexed = True,length = 100)
#     hash = CharField(indexed = True,length = 64)
#     remote = CharField(indexed = True,length = 100)
#     last_analyzed_snapshot = ForeignKeyField('GitSnapshot')
#     head_snapshot = ForeignKeyField('GitSnapshot')
# 
#     class Meta(BaseDocument.Meta):
# 
#         unique_together = [('project','name')]


from ..models import GitSnapshot,GitBranch
import logging

logger = logging.getLogger(__name__)

def before_project_save(settings, project):
    pass

def before_project_reset(settings, project):
    backend = project.backend

# Path: checkmate/contrib/plugins/git/models.py
# class GitSnapshot(BaseDocument):
# 
#     """
#     """
# 
#     project = ForeignKeyField('Project',unique = False,backref = 'git_snapshots')
#     snapshot = ForeignKeyField('Snapshot',unique = True,backref = 'git_snapshot')
#     sha = CharField(indexed = True,length = 40)
#     hash = CharField(indexed = True,length = 64)
#     committer_date = DateTimeField(indexed = True)
#     author_date = DateTimeField(indexed = True)
#     author_name = CharField(length = 100)
#     committer_date_ts = IntegerField(indexed = True)
#     author_date_ts = IntegerField(indexed = True)
#     tree_sha = CharField(indexed = True,length = 40)
#     log = TextField(indexed = False)
# 
#     class Meta(BaseDocument.Meta):
# 
#         unique_together = [('project','sha')]
# 
# class GitBranch(BaseDocument):
# 
#     project = ForeignKeyField('Project',backref = 'git_branches')
#     name = CharField(indexed = True,length = 100)
#     hash = CharField(indexed = True,length = 64)
#     remote = CharField(indexed = True,length = 100)
#     last_analyzed_snapshot = ForeignKeyField('GitSnapshot')
#     head_snapshot = ForeignKeyField('GitSnapshot')
# 
#     class Meta(BaseDocument.Meta):
# 
#         unique_together = [('project','name')]


# Path: checkmate/contrib/plugins/git/hooks/project.py
from ..models import GitSnapshot,GitBranch
import logging


logger = logging.getLogger(__name__)

def before_project_save(settings, project):
    pass

def before_project_reset(settings, project):
    backend = project.backend

    branches = backend.filter(GitBranch,{'project' : project})