def update_repositories(self):
        log = logging.getLogger('django_vcs_watch.jobs.update_repositories')

        new_reps = Repository.objects.find({'next_check_at': None})
        reps_to_update = Repository.objects.find({'next_check_at': {'$lte': datetime.datetime.utcnow()}})

        num_commits_before = Commit.objects.count()

        for rep in chain(new_reps, reps_to_update):
            log.debug('rep to update: %s' % rep.url)
            try:
                rep.update()
            except Exception, e:
                log.exception("can't update rep %s" % rep)

        Commit.objects.ensure_index([('date', 1)])

        return num_commits_before != Commit.objects.count()
dataset/ETHPy150Open svetlyak40wt/django-vcs-watch/src/django_vcs_watch/jobs/hourly/update_feeds.py/Job.update_repositories/original