1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

Implement --delete-generations + flag for keeping last N number of generations

This commit is contained in:
Matthew O'Gorman 2016-01-06 20:15:19 -05:00
parent 4a000cbb39
commit 429154b74c
4 changed files with 32 additions and 2 deletions

View file

@ -1284,6 +1284,8 @@ static void opDeleteGenerations(Globals & globals, Strings opFlags, Strings opAr
deleteOldGenerations(globals.profile, globals.dryRun);
} else if (opArgs.size() == 1 && opArgs.front().find('d') != string::npos) {
deleteGenerationsOlderThan(globals.profile, opArgs.front(), globals.dryRun);
} else if (opArgs.size() == 1 && opArgs.front().find('+') != string::npos) {
deleteGenerationsGreaterThan(globals.profile, opArgs.front(), globals.dryRun);
} else {
std::set<unsigned int> gens;
for (auto & i : opArgs) {