sapling/eden/fs/store/hg/HgManifestImporter.h
Adam Simpkins aa5e6c7295 update license headers in C++ files
Summary:
Update the copyright & license headers in C++ files to reflect the
relicensing to GPLv2

Reviewed By: wez

Differential Revision: D15487078

fbshipit-source-id: 19f24c933a64ecad0d3a692d0f8d2a38b4194b1d
2019-06-19 17:02:45 -07:00

66 lines
1.5 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#pragma once
#include <vector>
#include "eden/fs/store/LocalStore.h"
#include "eden/fs/utils/PathFuncs.h"
namespace facebook {
namespace eden {
class Hash;
class TreeEntry;
/*
* HgManifestImporter maintains state needed to process an
* HG manifest and create Tree objects from it.
*/
class HgManifestImporter {
public:
explicit HgManifestImporter(
LocalStore* store,
LocalStore::WriteBatch* writeBatch);
virtual ~HgManifestImporter();
/**
* processEntry() should be called for each manifest entry.
*
* This should be called in the order they are received from mercurial.
* (mercurial keeps the entries in sorted order.)
*/
void processEntry(RelativePathPiece dirname, TreeEntry&& entry);
/**
* finish() should be called once processEntry() has been called for
* all entries in the manifest.
*
* It returns the hash identifying the root Tree.
*/
Hash finish();
LocalStore* getLocalStore() const {
return store_;
}
private:
class PartialTree;
// Forbidden copy constructor and assignment operator
HgManifestImporter(const HgManifestImporter&) = delete;
HgManifestImporter& operator=(const HgManifestImporter&) = delete;
void popCurrentDir();
LocalStore* store_{nullptr};
std::vector<PartialTree> dirStack_;
LocalStore::WriteBatch* writeBatch_;
};
} // namespace eden
} // namespace facebook