bup 0.13.3__tar.gz → 0.14.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {bup-0.13.3/bup.egg-info → bup-0.14.0}/PKG-INFO +1 -1
  2. {bup-0.13.3 → bup-0.14.0}/bup/__version__.py +1 -1
  3. {bup-0.13.3 → bup-0.14.0}/bup/github_backup.py +21 -6
  4. {bup-0.13.3 → bup-0.14.0/bup.egg-info}/PKG-INFO +1 -1
  5. {bup-0.13.3 → bup-0.14.0}/LICENSE +0 -0
  6. {bup-0.13.3 → bup-0.14.0}/LICENSE.txt +0 -0
  7. {bup-0.13.3 → bup-0.14.0}/README.md +0 -0
  8. {bup-0.13.3 → bup-0.14.0}/bup/LICENSE +0 -0
  9. {bup-0.13.3 → bup-0.14.0}/bup/__init__.py +0 -0
  10. {bup-0.13.3 → bup-0.14.0}/bup/__main__.py +0 -0
  11. {bup-0.13.3 → bup-0.14.0}/bup/arguments.py +0 -0
  12. {bup-0.13.3 → bup-0.14.0}/bup/aws_cli.py +0 -0
  13. {bup-0.13.3 → bup-0.14.0}/bup/backup_types.py +0 -0
  14. {bup-0.13.3 → bup-0.14.0}/bup/bup.ico +0 -0
  15. {bup-0.13.3 → bup-0.14.0}/bup/bup.png +0 -0
  16. {bup-0.13.3 → bup-0.14.0}/bup/bup_base.py +0 -0
  17. {bup-0.13.3 → bup-0.14.0}/bup/cli/__init__.py +0 -0
  18. {bup-0.13.3 → bup-0.14.0}/bup/cli/cli_main.py +0 -0
  19. {bup-0.13.3 → bup-0.14.0}/bup/dynamodb_backup.py +0 -0
  20. {bup-0.13.3 → bup-0.14.0}/bup/gpl-3.0.md +0 -0
  21. {bup-0.13.3 → bup-0.14.0}/bup/gui/__init__.py +0 -0
  22. {bup-0.13.3 → bup-0.14.0}/bup/gui/about.py +0 -0
  23. {bup-0.13.3 → bup-0.14.0}/bup/gui/bup_dialog.py +0 -0
  24. {bup-0.13.3 → bup-0.14.0}/bup/gui/gui_icon.py +0 -0
  25. {bup-0.13.3 → bup-0.14.0}/bup/gui/gui_main.py +0 -0
  26. {bup-0.13.3 → bup-0.14.0}/bup/gui/log_widget.py +0 -0
  27. {bup-0.13.3 → bup-0.14.0}/bup/gui/preferences_widget.py +0 -0
  28. {bup-0.13.3 → bup-0.14.0}/bup/gui/run_backup_widget.py +0 -0
  29. {bup-0.13.3 → bup-0.14.0}/bup/log_routing.py +0 -0
  30. {bup-0.13.3 → bup-0.14.0}/bup/preferences.py +0 -0
  31. {bup-0.13.3 → bup-0.14.0}/bup/robust_os_calls.py +0 -0
  32. {bup-0.13.3 → bup-0.14.0}/bup/s3_backup.py +0 -0
  33. {bup-0.13.3 → bup-0.14.0}/bup/ui_types.py +0 -0
  34. {bup-0.13.3 → bup-0.14.0}/bup.egg-info/SOURCES.txt +0 -0
  35. {bup-0.13.3 → bup-0.14.0}/bup.egg-info/dependency_links.txt +0 -0
  36. {bup-0.13.3 → bup-0.14.0}/bup.egg-info/entry_points.txt +0 -0
  37. {bup-0.13.3 → bup-0.14.0}/bup.egg-info/requires.txt +0 -0
  38. {bup-0.13.3 → bup-0.14.0}/bup.egg-info/top_level.txt +0 -0
  39. {bup-0.13.3 → bup-0.14.0}/pyproject.toml +0 -0
  40. {bup-0.13.3 → bup-0.14.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bup
3
- Version: 0.13.3
3
+ Version: 0.14.0
4
4
  Summary: backup all your AWS S3 buckets and DynamoDB tables, and github repos to a backup directory/folder
5
5
  Author-email: abel <j@abel.co>
6
6
  License-Expression: GPL-3.0-only
@@ -1,4 +1,4 @@
1
- __version__ = "0.13.3"
1
+ __version__ = "0.14.0"
2
2
  __application_name__ = "bup"
3
3
  __title__ = __application_name__
4
4
  __author__ = "abel"
@@ -99,7 +99,7 @@ class GithubBackup(BupBase):
99
99
  except GitCommandError as e:
100
100
  self.warning_out(self.redact(f'could not pull "{repo_dir}" - will try to start over and do a clone of "{repo_owner_and_name},{e}","{__file__}"'))
101
101
 
102
- # new to us (or the pull failed, e.g. a force-pushed branch with a rewritten history) - clone the repo
102
+ # new to us (or the fetch/reset failed, e.g. a corrupt local clone) - clone the repo
103
103
  if not pull_success:
104
104
  try:
105
105
  if repo_dir.exists():
@@ -145,6 +145,20 @@ class GithubBackup(BupBase):
145
145
  except (GitCommandError, AttributeError, ValueError) as e:
146
146
  log.warning(self.redact(f'could not set remote url for "{repo_dir}" : {e}'))
147
147
 
148
+ # A backup is a mirror: the goal is "local == remote, exactly", never to integrate histories.
149
+ # So this is fetch + hard reset to the remote-tracking ref (the model git itself uses for mirrors),
150
+ # not "git pull" - a merge would fail on any force-pushed branch (rebased feature branches,
151
+ # CI-owned branches such as gh-pages or badges, orphan branches) and trigger a needless full re-clone.
152
+ # One fetch per repo transfers every branch's objects in a single negotiation; --prune drops
153
+ # remote-tracking refs for branches deleted on GitHub so the local ref set stays honest.
154
+ self.info_out(f'git fetch "{repo_name}"')
155
+ try:
156
+ git_repo.git.fetch("--prune", "origin")
157
+ except GitCommandError as e:
158
+ # recoverable - the caller falls back to a fresh clone, and escalates to an error if that also fails
159
+ self.warning_out(self.redact(f"{repo_name} : {e}"))
160
+ return False
161
+
148
162
  for branch in branches:
149
163
  if self.stop_requested:
150
164
  break
@@ -154,17 +168,18 @@ class GithubBackup(BupBase):
154
168
  if branch_name.lower() == "main" or (main_branch is None and branch_name.lower() == "master"):
155
169
  main_branch = branch
156
170
 
157
- self.info_out(f'git pull "{repo_name}" branch:"{branch_name}"')
171
+ self.info_out(f'git reset "{repo_name}" branch:"{branch_name}"')
158
172
  try:
159
173
  git_repo.git.reset("--hard")
160
174
  git_repo.git.clean("-fd")
161
- git_repo.git.checkout(branch_name)
162
- git_repo.git.pull()
175
+ git_repo.git.checkout(branch_name) # creates a local tracking branch from origin/<name> on first sight
176
+ git_repo.git.reset("--hard", f"origin/{branch_name}")
177
+ git_repo.git.clean("-fd")
163
178
  success = True
164
179
  except GitCommandError as e:
165
180
  if "did not match any file".lower() in str(e).lower():
166
181
  # new branch with no files yet - skip it and continue with other branches
167
- self.info_out(f"git pull {repo_name} branch:{branch_name} - no files")
182
+ self.info_out(f"git reset {repo_name} branch:{branch_name} - no files")
168
183
  continue
169
184
  elif "would be overwritten by checkout" in str(e).lower():
170
185
  # typically caused by CRLF line-ending normalization on Windows, not actual user edits
@@ -172,7 +187,7 @@ class GithubBackup(BupBase):
172
187
  success = False
173
188
  break
174
189
  else:
175
- # recoverable (e.g. a force-pushed branch whose rewritten history can't be merged) -
190
+ # recoverable (e.g. a corrupt object store) -
176
191
  # the caller falls back to a fresh clone, and escalates to an error if that also fails
177
192
  self.warning_out(self.redact(f"{repo_name} : {e}"))
178
193
  success = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bup
3
- Version: 0.13.3
3
+ Version: 0.14.0
4
4
  Summary: backup all your AWS S3 buckets and DynamoDB tables, and github repos to a backup directory/folder
5
5
  Author-email: abel <j@abel.co>
6
6
  License-Expression: GPL-3.0-only
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes