* Export/import many paths in one go.

This commit is contained in:
Eelco Dolstra 2007-02-21 23:00:31 +00:00
parent 9da367b7d5
commit 0db450024d

View file

@ -623,9 +623,13 @@ static void opExport(Strings opFlags, Strings opArgs)
i != opFlags.end(); ++i) i != opFlags.end(); ++i)
if (*i == "--sign") sign = true; if (*i == "--sign") sign = true;
else throw UsageError(format("unknown flag `%1%'") % *i); else throw UsageError(format("unknown flag `%1%'") % *i);
FdSink sink(STDOUT_FILENO); 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"); if (!opArgs.empty()) throw UsageError("no arguments expected");
FdSource source(STDIN_FILENO); FdSource source(STDIN_FILENO);
cout << format("%1%\n") % store->importPath(false, source); while (readInt(source) == 1)
cout << format("%1%\n") % store->importPath(false, source);
} }