Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for importing rsync-time-backup backups. #65

Merged
merged 3 commits into from
Jun 19, 2024

Conversation

cr1901
Copy link
Contributor

@cr1901 cr1901 commented Jan 10, 2024

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.

@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2024

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 ⚠️
src/borg_import/rsync_tmbackup.py 0.00% 20 Missing ⚠️

❗ 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              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small nitpicks

README.rst Outdated Show resolved Hide resolved
src/borg_import/helpers/timestamps.py Outdated Show resolved Hide resolved
src/borg_import/helpers/timestamps.py Outdated Show resolved Hide resolved
src/borg_import/main.py Show resolved Hide resolved
src/borg_import/helpers/timestamps.py Outdated Show resolved Hide resolved
Copy link
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datetime tests are somehow confusing.
some suggestions so that rhs and lhs of asserts precisely match.

src/borg_import/helpers/testsuite/test_timestamps.py Outdated Show resolved Hide resolved
src/borg_import/helpers/testsuite/test_timestamps.py Outdated Show resolved Hide resolved
src/borg_import/helpers/testsuite/test_timestamps.py Outdated Show resolved Hide resolved
@cr1901
Copy link
Contributor Author

cr1901 commented Jun 19, 2024

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.

Copy link
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@ThomasWaldmann ThomasWaldmann merged commit 961d25f into borgbackup:master Jun 19, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants