]> arthur.barton.de Git - bup.git/commitdiff
prune-older: enhance classify_saves comments
authorRob Browning <rlb@defaultvalue.org>
Sun, 23 Apr 2017 20:13:31 +0000 (15:13 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 23 Apr 2017 20:21:22 +0000 (15:21 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
cmd/prune-older-cmd.py

index fe45b95c4bef564b31429e5cf101ccc8aa7a3946..f2ba1d18b661b90dc9525e5bd30705b586483168 100755 (executable)
@@ -46,14 +46,18 @@ def classify_saves(saves, period_start):
                  (period_start['monthlies'], lambda s: localtime(s[0]).tm_mon),
                  (period_start['yearlies'], lambda s: localtime(s[0]).tm_year))
 
-    # Foreach period, seek back from now to the period's starting time, and
-    # collect the most recent saves
+    # Break the decreasing utc sorted saves up into the respective
+    # period ranges (dailies, monthlies, ...).  Within each range,
+    # group the saves by the period scale (days, months, ...), and
+    # then yield a "keep" action (True, utc) for the newest save in
+    # each group, and a "drop" action (False, utc) for the rest.
     for pstart, time_region_id in tm_ranges:
         matches, rest = partition(lambda s: s[0] >= pstart, rest)
         for region_id, region_saves in groupby(matches, time_region_id):
             for action in retain_newest_in_region(list(region_saves)):
                 yield action
 
+    # Finally, drop any saves older than the specified periods
     for save in rest:
         yield False, save