Add a copyStorePath() utility function

This commit is contained in:
Eelco Dolstra 2016-05-03 14:45:50 +02:00
parent 80f739b571
commit dfebfc835f
5 changed files with 27 additions and 10 deletions

View file

@ -357,6 +357,19 @@ const Store::Stats & Store::getStats()
}
void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
const Path & storePath)
{
auto info = srcStore->queryPathInfo(storePath);
StringSink sink;
srcStore->exportPaths({storePath}, false, sink);
StringSource source(*sink.s);
dstStore->importPaths(false, source, 0);
}
ValidPathInfo decodeValidPathInfo(std::istream & str, bool hashGiven)
{
ValidPathInfo info;