diff options
author | Matthew O'Gorman <mog@rldn.net> | 2016-05-19T19·42-0400 |
---|---|---|
committer | Matthew O'Gorman <mog@rldn.net> | 2018-03-02T02·47-0500 |
commit | 0312d30315a3a77ab659b742b76ec32685145715 (patch) | |
tree | df40aa3e5f5dcd40b1dcb258f70cf6bd3a92fb15 /src/libstore | |
parent | 429154b74c7f4b4d679ae79bbc939049f537bfaf (diff) |
this updates issues that were addressed by people in pr
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/profiles.cc | 17 | ||||
-rw-r--r-- | src/libstore/profiles.hh | 2 |
2 files changed, 7 insertions, 12 deletions
diff --git a/src/libstore/profiles.cc b/src/libstore/profiles.cc index e6300cf05552..44c3c6e0d478 100644 --- a/src/libstore/profiles.cc +++ b/src/libstore/profiles.cc @@ -157,15 +157,10 @@ void deleteGenerations(const Path & profile, const std::set<unsigned int> & gens } } -void deleteGenerationsGreaterThan(const Path & profile, const string & max, bool dryRun) +void deleteGenerationsGreaterThan(const Path & profile, int max, bool dryRun) { int max_keep = 0; PathLocks lock; - if(max.size() < 2) - throw Error(format("invalid number of generations ‘%1%’") % max); - string str_max = string(max, 1, max.size()); - if (!string2Int(str_max, max_keep) || max_keep == 0) - throw Error(format("invalid number of generations to keep ‘%1%’") % max); lockProfile(lock, profile); @@ -173,11 +168,11 @@ void deleteGenerationsGreaterThan(const Path & profile, const string & max, bool Generations gens = findGenerations(profile, curGen); for (auto i = gens.rbegin(); i != gens.rend(); ++i) { - if (max_keep) { - max_keep--; - continue; - } - deleteGeneration2(profile, i->number, dryRun); + if (max) { + max--; + continue; + } + deleteGeneration2(profile, i->number, dryRun); } } diff --git a/src/libstore/profiles.hh b/src/libstore/profiles.hh index 3cad08dc5265..5fa1533de311 100644 --- a/src/libstore/profiles.hh +++ b/src/libstore/profiles.hh @@ -39,7 +39,7 @@ void deleteGeneration(const Path & profile, unsigned int gen); void deleteGenerations(const Path & profile, const std::set<unsigned int> & gensToDelete, bool dryRun); -void deleteGenerationsGreaterThan(const Path & profile, const string & max, bool dryRun); +void deleteGenerationsGreaterThan(const Path & profile, const int max, bool dryRun); void deleteOldGenerations(const Path & profile, bool dryRun); |