Save the last successful backup and add --last-backup
Write the completion time and backup directory to $XDG_STATE_HOME/simple_backup/last_backup after each successful backup (as the target user when run as root), for status bar reminders. --last-backup prints it.
This commit is contained in:
+5
-1
@@ -201,7 +201,11 @@ class TestRsync:
|
||||
for _ in range(2):
|
||||
assert run_cli('-c', config_file, '-i', str(src), '-o', str(out), '-k', '0') == 0
|
||||
|
||||
assert backups(out) == ['2026-10-14_11-00-00']
|
||||
# The fake clock also advances when the state file is written
|
||||
assert backups(out) == ['2026-10-14_12-00-00']
|
||||
state = (tmp_path / 'state' / 'simple_backup' / 'last_backup').read_text().splitlines()
|
||||
assert state[0].startswith('2026-10-14T13:00:00')
|
||||
assert state[1] == f'{out}/simple_backup/2026-10-14_12-00-00'
|
||||
|
||||
|
||||
class ChunkStream(io.BufferedIOBase):
|
||||
|
||||
Reference in New Issue
Block a user