# Path: checkmate/management/commands/base.py
# class BaseCommand(object):
# 
#     class CommandException(BaseException):
#         pass
# 
#     requires_valid_project = True
# 
#     options = [
#         {
#         'name'        : '--help',
#         'action'      : 'store_true',
#         'dest'        : 'help',
#         'default'     : False,
#         'help'        : 'display this help message.'
#         },
#         {
#         'name'        : '--non-interactive',
#         'action'      : 'store_true',
#         'dest'        : 'non_interactive',
#         'default'     : False,
#         'help'        : 'non-interactive mode.'
#         },
#         {
#         'name'        : '--format',
#         'action'      : 'store',
#         'dest'        : 'format',
#         'default'     : 'python',
#         'help'        : 'the output format for the return value of the command.'
#         },
#         ]
# 
#     description = None
# 
#     def __init__(self, project, settings, backend=None, prog=None, args=None):
#         self.project = project
#         self.settings = settings
#         self.backend = backend
#         self.prog = prog
#         self.parse_args(args if args else [])
# 
#     def _get_parser(self):
#         parser = argparse.ArgumentParser(self.prog,add_help = False,description = self.description)
#         for opt in self.options:
#             c_opt = copy.deepcopy(opt)
#             name = c_opt['name']
#             del c_opt['name']
#             parser.add_argument(name,**c_opt)
#         return parser
# 
#     def parse_args(self,raw_args):
#         parser = self._get_parser()
#         args,self.extra_args = parser.parse_known_args(raw_args)
#         self.raw_args = raw_args
#         self.opts = vars(args)
# 
#     def help_message(self):
#         parser = self._get_parser()
#         return parser.format_help()
# 
# Path: checkmate/contrib/plugins/git/models.py
# 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')]


import logging
from collections import defaultdict
from checkmate.management.commands.base import BaseCommand
from ..models import GitBranch
# -*- coding: utf-8 -*-

from __future__ import unicode_literals


logger = logging.getLogger(__name__)

class Command(BaseCommand):

    def run(self):


# Path: checkmate/management/commands/base.py
# class BaseCommand(object):
# 
#     class CommandException(BaseException):
#         pass
# 
#     requires_valid_project = True
# 
#     options = [
#         {
#         'name'        : '--help',
#         'action'      : 'store_true',
#         'dest'        : 'help',
#         'default'     : False,
#         'help'        : 'display this help message.'
#         },
#         {
#         'name'        : '--non-interactive',
#         'action'      : 'store_true',
#         'dest'        : 'non_interactive',
#         'default'     : False,
#         'help'        : 'non-interactive mode.'
#         },
#         {
#         'name'        : '--format',
#         'action'      : 'store',
#         'dest'        : 'format',
#         'default'     : 'python',
#         'help'        : 'the output format for the return value of the command.'
#         },
#         ]
# 
#     description = None
# 
#     def __init__(self, project, settings, backend=None, prog=None, args=None):
#         self.project = project
#         self.settings = settings
#         self.backend = backend
#         self.prog = prog
#         self.parse_args(args if args else [])
# 
#     def _get_parser(self):
#         parser = argparse.ArgumentParser(self.prog,add_help = False,description = self.description)
#         for opt in self.options:
#             c_opt = copy.deepcopy(opt)
#             name = c_opt['name']
#             del c_opt['name']
#             parser.add_argument(name,**c_opt)
#         return parser
# 
#     def parse_args(self,raw_args):
#         parser = self._get_parser()
#         args,self.extra_args = parser.parse_known_args(raw_args)
#         self.raw_args = raw_args
#         self.opts = vars(args)
# 
#     def help_message(self):
#         parser = self._get_parser()
#         return parser.format_help()
# 
# Path: checkmate/contrib/plugins/git/models.py
# 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/commands/update_stats.py
import logging
from collections import defaultdict
from checkmate.management.commands.base import BaseCommand
from ..models import GitBranch

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

from __future__ import unicode_literals


logger = logging.getLogger(__name__)

class Command(BaseCommand):

    def run(self):


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