From 0db450024dbeadf0c595a6de8743b7cb8f3dcbcd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 21 Feb 2007 23:00:31 +0000 Subject: [PATCH] * Export/import many paths in one go. --- src/nix-store/nix-store.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 293becc686..9c4790039e 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -623,9 +623,13 @@ static void opExport(Strings opFlags, Strings opArgs) i != opFlags.end(); ++i) if (*i == "--sign") sign = true; else throw UsageError(format("unknown flag `%1%'") % *i); - + FdSink sink(STDOUT_FILENO); - store->exportPath(*opArgs.begin(), sign, sink); + for (Strings::iterator i = opArgs.begin(); i != opArgs.end(); ++i) { + writeInt(1, sink); + store->exportPath(*i, sign, sink); + } + writeInt(0, sink); } @@ -635,7 +639,8 @@ static void opImport(Strings opFlags, Strings opArgs) if (!opArgs.empty()) throw UsageError("no arguments expected"); FdSource source(STDIN_FILENO); - cout << format("%1%\n") % store->importPath(false, source); + while (readInt(source) == 1) + cout << format("%1%\n") % store->importPath(false, source); }