borg-import icon indicating copy to clipboard operation
borg-import copied to clipboard

Add support for importing rsync-time-backup backups.

Open cr1901 opened this issue 2 years ago • 1 comments

rsync-time-backup was my previous preferred backup solution. You can import backups from this program just fine using rsynchl.

However, for rsync_tmbackup, archives timestamps are better derived from each folder name rather than folder mtime. Since folder names are timestamps, I mandate using --prefix.

Additionally, thanks to parsing times from folder names, this PR marks the first use of datetime_from_string outside of tests. I modified datetime_from_string to return UTC-aware datetimes. There are at least two issues with using strptime for aware datetimes:

  1. Ignores time zones in %Z, except for small number of cases.
  2. Even if %Z parses successfully, only %z returns a timezone-aware datetime.

Therefore, I improvised to make %a %b %d %H:%M:%S %Z %Y formatting (the only supported format w/ a time zone) to return a UTC-aware timestamp. If you don't like this at all, I'm open to changing it.

cr1901 avatar Jan 10 '24 23:01 cr1901

Codecov Report

Attention: 57 lines in your changes are missing coverage. Please review.

Comparison is base (4eb1352) 20.18% compared to head (e602abc) 16.60%.

Files Patch % Lines
src/borg_import/main.py 0.00% 37 Missing :warning:
src/borg_import/rsync_tmbackup.py 0.00% 20 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #65      +/-   ##
==========================================
- Coverage   20.18%   16.60%   -3.58%     
==========================================
  Files           7        8       +1     
  Lines         218      277      +59     
  Branches       33       43      +10     
==========================================
+ Hits           44       46       +2     
- Misses        173      230      +57     
  Partials        1        1              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Jan 10 '24 23:01 codecov-commenter

It's been 5 months, and I am finally in a position to continue importing my backups. With your requested changes applied, I've been using borg-import again tonight to import rsync_tmbackup backups, and it's been working just fine :D.

I can't remember if you wanted more changes- I'll have to check my IRC logs from around those dates. Happy to add any more requested changes of course. But just wanted to confirm that after several months of leaving it alone, my changes are working just fine for me.

cr1901 avatar Jun 19 '24 03:06 cr1901