示例#1
0
def cache(repo):
    """Cache the given repository to reuse later

    Args:
        repo: A repository instance
    """
    repositories = get_repo_collection()
    repo.update_last_latest_hash()
    repositories.update({'url': repo.url}, repo.to_document(), upsert=True)
示例#2
0
def is_cached(repo):
    """Check if the repository was cached

    Args:
        repo: A repository instance

    Returns:
        Whether if there is cached one or not
    """
    repositories = get_repo_collection()
    repo_doc = repositories.find_one({'url': repo.url})

    if not repo_doc:
        return False
    if repo_doc['last_latest_hash'] != repo.latest_hash:
        return False
    return True
示例#3
0
def is_cached(repo):
    """Check if the repository was cached

    Args:
        repo: A repository instance

    Returns:
        Whether if there is cached one or not
    """
    repositories = get_repo_collection()
    repo_doc = repositories.find_one({'url': repo.url})

    if not repo_doc:
        return False
    if repo_doc['last_latest_hash'] != repo.latest_hash:
        return False
    return True
示例#4
0
 def setUp(self):
     self.repositories = get_repo_collection()
     self.repo = create_repository('github.com/mingrammer/sorting')
示例#5
0
 def setUp(self):
     self.repositories = get_repo_collection()
     self.repo = create_repository('github.com/mingrammer/awesome-finder')
示例#6
0
 def setUp(self):
     self.repositories = get_repo_collection()
     self.repo = create_repository('github.com/mingrammer/sorting')