From dfebfc835f7b8156a559314bcd1ecff739c14fd1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 May 2016 14:45:50 +0200 Subject: Add a copyStorePath() utility function --- src/libstore/store-api.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/libstore/store-api.cc') diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 463e132e0299..b03e4080afc2 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -357,6 +357,19 @@ const Store::Stats & Store::getStats() } +void copyStorePath(ref srcStore, ref 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; -- cgit 1.4.1