From 52bf9b86bb79369b7f7b5b8a5726b83ee154da6a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 25 Jan 2005 11:18:03 +0000 Subject: * In nix-store: added query `--referers-closure' that returns the closure of the referers relation rather than the references relation, i.e., the set of all paths that directly or indirectly refer to the given path. Note that contrary to the references closure this set is not fixed; it can change as paths are added to or removed from the store. --- src/libstore/misc.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/libstore/misc.cc') diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc index dbb9273f7955..802e576512f1 100644 --- a/src/libstore/misc.cc +++ b/src/libstore/misc.cc @@ -12,17 +12,20 @@ Derivation derivationFromPath(const Path & drvPath) void computeFSClosure(const Path & storePath, - PathSet & paths) + PathSet & paths, bool flipDirection) { if (paths.find(storePath) != paths.end()) return; paths.insert(storePath); PathSet references; - queryReferences(storePath, references); + if (flipDirection) + queryReferers(storePath, references); + else + queryReferences(storePath, references); for (PathSet::iterator i = references.begin(); i != references.end(); ++i) - computeFSClosure(*i, paths); + computeFSClosure(*i, paths, flipDirection); } -- cgit 1.4.1