Skip to content

Commit c0a6961

Browse files
committed
Renames --since to --from
1 parent fe0d2d1 commit c0a6961

5 files changed

Lines changed: 46 additions & 46 deletions

File tree

docs/misc/prune-example-interval.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ borg prune \
2121
--keep-weekly 4 \
2222
--keep-monthly 5m \
2323
--keep-yearly 2 \
24-
--since '2026-06-04 16:00'
24+
--from '2026-06-04 16:00'
2525
```
2626

2727
The `--keep-*` options reflect the intended retention policy exactly. Note the
2828
different wording in the retention policy for weekly and yearly archives: They
2929
aren't *interval*-based, but *count*-based.
3030

31-
Another important detail here is `--since`. Without it, intervals would be
31+
Another important detail here is `--from`. Without it, intervals would be
3232
calculated relative to the actual start time of `prune` - in this case 16:12.
3333
Since your backups are always created at 16:00, this 12-minute shift would move
3434
the cutoff point of intervals and could cause archives near the boundary to
3535
unexpectedly fall outside the expected time window.
3636

37-
By specifying `--since '2026-06-04 16:00'`, all intervals are anchored to the
37+
By specifying `--from '2026-06-04 16:00'`, all intervals are anchored to the
3838
intended reference time (16:00), not the moment `prune` happens to run. This
3939
ensures stable and predictable retention behavior, independent of when `prune`
4040
actually runs.
@@ -48,7 +48,7 @@ Archives kept by the `--keep-daily` rule are marked by a "d" to the right,
4848
archives kept by the `--keep-weekly` rule are marked by a "w" to the right,
4949
archives kept by the `--keep-monthly` rule are marked by a "m" to the right,
5050
archives kept by the `--keep-yearly` rule are marked by a "y" to the right, and
51-
archives kept by the `--since` rule are marked by a "x" to the right.
51+
archives kept by the `--from` rule are marked by a "x" to the right.
5252

5353

5454
Calendar view
@@ -91,25 +91,25 @@ List view
9191
5. 2026-05-29 5. 2025-12-31
9292
6. 2026-05-28
9393

94-
2026-06-04 is additionally kept due to `--since`.
94+
2026-06-04 is additionally kept due to `--from`.
9595

9696

9797
Notes
9898
-----
9999

100100
The current day's archive is always kept, because `create` ran after the date
101-
given with `--since`. For `prune`, it's as if this archive doesn't exist (yet).
101+
given with `--from`. For `prune`, it's as if this archive doesn't exist (yet).
102102

103103
2026-06-03 was skipped, so no archive can be kept with `--keep-daily` for that
104104
day. Other than with a *count*-based policy, no compensation is made for an
105105
*interval* like `--keep-daily 1w`, so the rule simply keeps one archive fewer.
106106

107-
2026-05-28 16:00 is exactly one week before `--since`. Since `create` always
107+
2026-05-28 16:00 is exactly one week before `--from`. Since `create` always
108108
runs after 16:00, the archive created on 2026-05-28 is kept, too. Without
109-
`--since`, Borg would cut off at 2026-05-28 16:12 instead, which would likely
110-
mean that the archive created on 2026-05-28 would be pruned. `--since` ensures
109+
`--from`, Borg would cut off at 2026-05-28 16:12 instead, which would likely
110+
mean that the archive created on 2026-05-28 would be pruned. `--from` ensures
111111
that 2026-05-28 is consistently kept. If you want it consistently pruned, try a
112-
later reference time, e.g. `--since '2026-06-04 23:59:59'`.
112+
later reference time, e.g. `--from '2026-06-04 23:59:59'`.
113113

114114
2026-05-31 is considered not only by `--keep-daily`, but by `--keep-weekly`
115115
and `--keep-monthly`, too. The archive is effectively kept by `--keep-daily`,

docs/usage/general/date-time.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ days (e.g. ``7d``), hours (e.g. ``8H``), minutes (e.g. ``30M``), or seconds
2020
The ``borg prune`` ``--keep-*`` retention options accept either a plain count
2121
(e.g. ``--keep-daily 7``, keeping up to 7 daily archives) or a time interval
2222
(e.g. ``--keep-daily 7d``, keeping one daily archive per day within a 7-day window).
23-
When using interval-based retention, ``--since`` may be specified to set the
23+
When using interval-based retention, ``--from`` may be specified to set the
2424
reference timestamp for the interval (defaults to the current time).
2525

2626
Please note that Borg treats months (e.g. ``12m``) as fixed 31-day periods

docs/usage/prune.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The ``--keep-*`` options accept either a **count** (e.g. ``--keep-daily 7``) or
2727
a **time interval** (e.g. ``--keep-daily 7d``). A count keeps up to *N* archives
2828
per period (e.g. the last 7 daily archives), while an interval keeps one
2929
archive per period within that time span (e.g. one daily archive per day in the
30-
last 7-day window). When using intervals, you may also specify ``--since`` to
30+
last 7-day window). When using intervals, you may also specify ``--from`` to
3131
set the reference timestamp for interval calculation.
3232

3333
::
@@ -55,7 +55,7 @@ set the reference timestamp for interval calculation.
5555
$ borg prune -v --list --dry-run --keep-daily=7d
5656

5757
# Same as above, but with a fixed reference timestamp:
58-
$ borg prune -v --list --dry-run --since 2025-12-01T00:00:00+02:00 --keep-daily=7d
58+
$ borg prune -v --list --dry-run --from 2025-12-01T00:00:00+02:00 --keep-daily=7d
5959

6060
# Keep the last 14 archives using `--keep`:
6161
$ borg prune -v --list --dry-run --keep 14

src/borg/archiver/prune_cmd.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ def quarterly_3monthly_period_func(dt):
107107
PRUNE_QUARTERLY_3MONTHLY = PruningRule("quarterly_3monthly", quarterly_3monthly_period_func)
108108
PRUNE_YEARLY = PruningRule("yearly", pattern_period_func("%Y"))
109109

110-
# Fake rule used to indicate archives skipped by --since
111-
PRUNE_SINCE = PruningRule("skip", unique_period_func())
110+
# Fake rule used to indicate archives skipped by --from
111+
PRUNE_FROM = PruningRule("skip", unique_period_func())
112112

113113
PRUNING_RULES = [
114114
PRUNE_KEEP,
@@ -182,18 +182,18 @@ def do_prune(self, args, repository, manifest):
182182
# Archives to keep along with the rule that ensured them being kept
183183
keep = {}
184184

185-
since = getattr(args, PRUNE_SINCE.key)
185+
from_timestamp = getattr(args, PRUNE_FROM.key)
186186
candidate_archives = archives
187187

188-
if since is not None:
189-
base_timestamp = since
188+
if from_timestamp is not None:
189+
base_timestamp = from_timestamp
190190

191-
# `--since` is a prefilter: Archives made at or after this time are kept by default. They are not considered
191+
# `--from` is a prefilter: Archives made at or after this time are kept by default. They are not considered
192192
# for pruning at all and thus won't falsely occupy an active retention period.
193193
for archive in archives:
194-
if archive.ts < since:
194+
if archive.ts < from_timestamp:
195195
break
196-
keep[archive] = KeepResult(rule=PRUNE_SINCE, idx=len(keep))
196+
keep[archive] = KeepResult(rule=PRUNE_FROM, idx=len(keep))
197197
candidate_archives = archives[len(keep) :]
198198
else:
199199
base_timestamp = datetime.now().astimezone()
@@ -366,7 +366,7 @@ def build_parser_prune(self, subparsers, common_parser, mid_common_parser):
366366
policy. It accepts a count or a time interval for retention (e.g.
367367
``10`` or ``7d``, ``4w``). With a count it keeps at most that many
368368
recent archives; with an interval it keeps all archives created within
369-
that time window. When ``--since`` is given together with an interval
369+
that time window. When ``--from`` is given together with an interval
370370
retention, the interval is measured backwards from that timestamp
371371
instead of from the current time. See ``Date and Time`` docs for exact
372372
INTERVAL format.
@@ -380,14 +380,14 @@ def build_parser_prune(self, subparsers, common_parser, mid_common_parser):
380380
period, e.g. one per day or one per month until the retention count is
381381
met). With a retention interval, they keep one archive per period
382382
within that time span (e.g. at most one per day in a span of seven
383-
days, even if some days had none) -- measured from ``--since`` if given,
383+
days, even if some days had none) -- measured from ``--from`` if given,
384384
otherwise from the current time. Specifying a count of ``-1`` (or the
385385
word ``all``) means no limit. A zero count or zero-length interval
386386
keeps nothing.
387387
388-
The ``--since`` option restricts pruning to archives older than the given
388+
The ``--from`` option restricts pruning to archives older than the given
389389
TIMESTAMP. Archives made at or after this timestamp are kept unconditionally
390-
as a pre-filter. When ``--since`` is used together with interval-based
390+
as a pre-filter. When ``--from`` is used together with interval-based
391391
``--keep-*`` options (e.g. ``--keep-daily 7d``), the interval is measured
392392
backwards from the given timestamp rather than from the current time.
393393
Count-based retention does not count the unconditionally kept archives.
@@ -417,10 +417,10 @@ def build_parser_prune(self, subparsers, common_parser, mid_common_parser):
417417
older history gradually thins out with time. For example,
418418
``--keep-daily 7d --keep-weekly 4w --keep-monthly 6`` keeps an
419419
archive per day for the past week, per week for the past month, and
420-
one per month for six months after that. Combine this with ``--since``
420+
one per month for six months after that. Combine this with ``--from``
421421
to align time windows to calendar boundaries rather than the exact
422422
moment you run prune for more predictable behavior of coarser rules:
423-
``--keep-daily 7d --keep-weekly 4w --since $(date +%F)``.
423+
``--keep-daily 7d --keep-weekly 4w --from $(date +%F)``.
424424
425425
Count-based retention keeps archives less bound to time. For instance,
426426
``--keep-yearly 3`` retains 3 yearly archives however far back they
@@ -476,9 +476,9 @@ def build_parser_prune(self, subparsers, common_parser, mid_common_parser):
476476
"Some keys are always present. Note: JSON can only represent text.",
477477
)
478478
subparser.add_argument(
479-
"--since",
479+
"--from",
480480
metavar="TIMESTAMP",
481-
dest=PRUNE_SINCE.key,
481+
dest=PRUNE_FROM.key,
482482
type=timestamp,
483483
action=Highlander,
484484
help="only consider archives older than this for pruning",

0 commit comments

Comments
 (0)