sapling/ctreemanifest/manifest_fetcher.cpp
Durham Goode 195cb62bde ctreemanifest: remove PythonObj from manifest data structures
Summary:
The old code kept a PythonObj around inside the ManifestFetcher for fetching
manifest contents from the store. As part of moving the treemanifest code to use
the new native cstore API let's make the manifest code depend on a Store
abstraction and have one implementation be a PythonStore.

This removes almost all of the python dependencies from the core treemanifest
code, except some logic around running the python matcher during iteration and
writing directly to the python result dict during diff. We'll abstract those
away later.

Test Plan: Built and ran the tests

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4569944

Signature: t1:4569944:1487847102:d005b6484fd7de9335961b0bc4530505b25f961d
2017-02-23 14:03:03 -08:00

26 lines
779 B
C++

// manifest_fetcher.cpp - c++ implementation of a fetcher for manifests
//
// Copyright 2016 Facebook, Inc.
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
//
// no-check-code
#include "manifest_fetcher.h"
ManifestFetcher::ManifestFetcher(std::shared_ptr<Store> store) :
_store(store) {
}
/**
* Fetches the Manifest from the store for the provided manifest key.
* Returns the manifest if found, or throws an exception if not found.
*/
ManifestPtr ManifestFetcher::get(
const char *path, size_t pathlen,
std::string &node) const {
ConstantStringRef content = _store->get(Key(path, pathlen, node.c_str(), node.size()));
return ManifestPtr(new Manifest(content));
}