Compare commits

..

13 Commits

Author SHA1 Message Date
GitHub Action
fcf21f7a2e Release version 0.48.0 2025-01-04 01:15:18 +00:00
Jose Diaz-Gonzalez
36812a332b Merge pull request #377 from josegonzalez/fix-lint-errors
chore: reformat file to fix lint issues
2025-01-03 20:08:30 -05:00
Jose Diaz-Gonzalez
0e0197149e chore: reformat file to fix lint issues 2025-01-03 20:07:40 -05:00
Jose Diaz-Gonzalez
eb545c1c2f Merge pull request #372 from josegonzalez/dependabot/pip/python-packages-7fa4717ed3
chore(deps): bump the python-packages group across 1 directory with 4 updates
2025-01-03 20:06:03 -05:00
Jose Diaz-Gonzalez
2e72797984 Merge pull request #376 from adamsmd/patch-2
Update required permissions listed in README.rst
2025-01-03 20:05:43 -05:00
dependabot[bot]
68fe29d1e1 chore(deps): bump the python-packages group across 1 directory with 4 updates
Bumps the python-packages group with 4 updates in the / directory: [charset-normalizer](https://github.com/jawah/charset_normalizer), [click](https://github.com/pallets/click), [keyring](https://github.com/jaraco/keyring) and [urllib3](https://github.com/urllib3/urllib3).


Updates `charset-normalizer` from 3.4.0 to 3.4.1
- [Release notes](https://github.com/jawah/charset_normalizer/releases)
- [Changelog](https://github.com/jawah/charset_normalizer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jawah/charset_normalizer/compare/3.4.0...3.4.1)

Updates `click` from 8.1.7 to 8.1.8
- [Release notes](https://github.com/pallets/click/releases)
- [Changelog](https://github.com/pallets/click/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/click/compare/8.1.7...8.1.8)

Updates `keyring` from 25.5.0 to 25.6.0
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/NEWS.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v25.5.0...v25.6.0)

Updates `urllib3` from 2.2.3 to 2.3.0
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.2.3...2.3.0)

---
updated-dependencies:
- dependency-name: charset-normalizer
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: python-packages
- dependency-name: click
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: python-packages
- dependency-name: keyring
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: urllib3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-30 13:34:44 +00:00
Michael D. Adams
3dc3691770 Update required permissions listed in README.rst
Removed unused permissions, and changed names to those currently used by GitHub.

- code: renamed to contents as used by GitHub
- commit statuses: removed because not used by github-backup
- pages: removed because not used by github-backup
- repository hooks: renamed to webhooks as used by GitHub
2024-12-29 09:02:34 +00:00
Jose Diaz-Gonzalez
5b0608ce14 Merge pull request #374 from adamsmd/patch-1
Fix typo README.rst: --starred-gists that should be --gists
2024-12-29 00:40:26 -05:00
Jose Diaz-Gonzalez
1ce8455860 Merge pull request #375 from ethanwhite/docs-fix
Remove fixed release issue from known blocking errors
2024-12-29 00:40:13 -05:00
Ethan White
dcb89a5c33 Remove fixed release issue from known blocking errors
The issue with --release producing errors documented in #209 (the linked issue) and #234 appears to have been fixed in #257.

This change removes the associated warning from the README.
2024-12-28 06:41:54 -05:00
Michael D. Adams
b0bfffde1a Fix typo README.rst: --starred-gists that should be --gists 2024-12-28 10:14:37 +00:00
Jose Diaz-Gonzalez
0f3aaa6fc2 Merge pull request #369 from josegonzalez/dependabot/pip/python-packages-d3e2c9eccf
chore(deps): bump certifi from 2024.8.30 to 2024.12.14 in the python-packages group
2024-12-16 22:55:40 -05:00
dependabot[bot]
c39ec9c549 chore(deps): bump certifi in the python-packages group
Bumps the python-packages group with 1 update: [certifi](https://github.com/certifi/python-certifi).


Updates `certifi` from 2024.8.30 to 2024.12.14
- [Commits](https://github.com/certifi/python-certifi/compare/2024.08.30...2024.12.14)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-16 13:14:44 +00:00
5 changed files with 122 additions and 38 deletions

View File

@@ -1,9 +1,82 @@
Changelog
=========
0.47.0 (2024-12-09)
0.48.0 (2025-01-04)
-------------------
------------------------
- Chore: reformat file to fix lint issues. [Jose Diaz-Gonzalez]
- Chore(deps): bump the python-packages group across 1 directory with 4
updates. [dependabot[bot]]
Bumps the python-packages group with 4 updates in the / directory: [charset-normalizer](https://github.com/jawah/charset_normalizer), [click](https://github.com/pallets/click), [keyring](https://github.com/jaraco/keyring) and [urllib3](https://github.com/urllib3/urllib3).
Updates `charset-normalizer` from 3.4.0 to 3.4.1
- [Release notes](https://github.com/jawah/charset_normalizer/releases)
- [Changelog](https://github.com/jawah/charset_normalizer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jawah/charset_normalizer/compare/3.4.0...3.4.1)
Updates `click` from 8.1.7 to 8.1.8
- [Release notes](https://github.com/pallets/click/releases)
- [Changelog](https://github.com/pallets/click/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/click/compare/8.1.7...8.1.8)
Updates `keyring` from 25.5.0 to 25.6.0
- [Release notes](https://github.com/jaraco/keyring/releases)
- [Changelog](https://github.com/jaraco/keyring/blob/main/NEWS.rst)
- [Commits](https://github.com/jaraco/keyring/compare/v25.5.0...v25.6.0)
Updates `urllib3` from 2.2.3 to 2.3.0
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.2.3...2.3.0)
---
updated-dependencies:
- dependency-name: charset-normalizer
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: python-packages
- dependency-name: click
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: python-packages
- dependency-name: keyring
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: python-packages
- dependency-name: urllib3
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: python-packages
...
- Fix typo README.rst: --starred-gists that should be --gists. [Michael
D. Adams]
- Remove fixed release issue from known blocking errors. [Ethan White]
The issue with --release producing errors documented in #209 (the linked issue) and #234 appears to have been fixed in #257.
This change removes the associated warning from the README.
- Chore(deps): bump certifi in the python-packages group.
[dependabot[bot]]
Bumps the python-packages group with 1 update: [certifi](https://github.com/certifi/python-certifi).
Updates `certifi` from 2024.8.30 to 2024.12.14
- [Commits](https://github.com/certifi/python-certifi/compare/2024.08.30...2024.12.14)
---
updated-dependencies:
- dependency-name: certifi
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: python-packages
...
0.47.0 (2024-12-09)
-------------------
- Detect empty HTTPS contexts. [John Doe]
Some users are relying solely on the certifi package to provide their CA certs, as requests does this by default.

View File

@@ -167,7 +167,7 @@ Customise the permissions for your use case, but for a personal account full bac
**User permissions**: Read access to followers, starring, and watching.
**Repository permissions**: Read access to code, commit statuses, issues, metadata, pages, pull requests, and repository hooks.
**Repository permissions**: Read access to contents, issues, metadata, pull requests, and webhooks.
Prefer SSH
@@ -225,7 +225,7 @@ Gotchas / Known-issues
All is not everything
---------------------
The ``--all`` argument does not include: cloning private repos (``-P, --private``), cloning forks (``-F, --fork``), cloning starred repositories (``--all-starred``), ``--pull-details``, cloning LFS repositories (``--lfs``), cloning gists (``--starred-gists``) or cloning starred gist repos (``--starred-gists``). See examples for more.
The ``--all`` argument does not include: cloning private repos (``-P, --private``), cloning forks (``-F, --fork``), cloning starred repositories (``--all-starred``), ``--pull-details``, cloning LFS repositories (``--lfs``), cloning gists (``--gists``) or cloning starred gist repos (``--starred-gists``). See examples for more.
Cloning all starred size
------------------------
@@ -254,12 +254,6 @@ It's therefore recommended to only use the incremental argument if the output/re
This is due to needing the correct permission for ``--hooks`` on public repos.
2. **Releases blocking**
A known ``--releases`` (required for ``--assets``) error will sometimes block the backup.
If you're backing up a lot of repositories with releases e.g. an organisation or ``--all-starred``. You may need to remove ``--releases`` (and therefore ``--assets``) to complete a backup. Documented in `issue 209 <https://github.com/josegonzalez/python-github-backup/issues/209>`_.
"bare" is actually "mirror"
---------------------------

View File

@@ -1 +1 @@
__version__ = "0.47.0"
__version__ = "0.48.0"

View File

@@ -19,12 +19,12 @@ import ssl
import subprocess
import sys
import time
from datetime import datetime
from http.client import IncompleteRead
from urllib.error import HTTPError, URLError
from urllib.parse import quote as urlquote
from urllib.parse import urlencode, urlparse
from urllib.request import HTTPRedirectHandler, Request, build_opener, urlopen
from datetime import datetime
try:
from . import __version__
@@ -40,16 +40,21 @@ logger = logging.getLogger(__name__)
https_ctx = ssl.create_default_context()
if not https_ctx.get_ca_certs():
import warnings
warnings.warn('\n\nYOUR DEFAULT CA CERTS ARE EMPTY.\n' +
'PLEASE POPULATE ANY OF:' +
''.join([
'\n - ' + x
for x in ssl.get_default_verify_paths()
if type(x) is str
]) + '\n', stacklevel=2)
warnings.warn(
"\n\nYOUR DEFAULT CA CERTS ARE EMPTY.\n"
+ "PLEASE POPULATE ANY OF:"
+ "".join(
["\n - " + x for x in ssl.get_default_verify_paths() if type(x) is str]
)
+ "\n",
stacklevel=2,
)
import certifi
https_ctx = ssl.create_default_context(cafile=certifi.where())
def logging_subprocess(
popenargs, stdout_log_level=logging.DEBUG, stderr_log_level=logging.ERROR, **kwargs
):
@@ -795,13 +800,15 @@ def download_file(url, path, auth, as_app=False, fine=False):
if os.path.exists(path):
return
request = _construct_request(per_page=100,
request = _construct_request(
per_page=100,
page=1,
query_args={},
template=url,
auth=auth,
as_app=as_app,
fine=fine)
fine=fine,
)
request.add_header("Accept", "application/octet-stream")
opener = build_opener(S3HTTPRedirectHandler)
@@ -944,11 +951,15 @@ def filter_repositories(args, unfiltered_repositories):
if r.get("language") and r.get("language").lower() in languages
] # noqa
if name_regex:
repositories = [r for r in repositories if "name" not in r or name_regex.match(r["name"])]
repositories = [
r for r in repositories if "name" not in r or name_regex.match(r["name"])
]
if args.skip_archived:
repositories = [r for r in repositories if not r.get("archived")]
if args.exclude:
repositories = [r for r in repositories if "name" not in r or r["name"] not in args.exclude]
repositories = [
r for r in repositories if "name" not in r or r["name"] not in args.exclude
]
return repositories
@@ -1244,9 +1255,15 @@ def backup_releases(args, repo_cwd, repository, repos_template, include_assets=F
if args.skip_prerelease:
releases = [r for r in releases if not r["prerelease"] and not r["draft"]]
if args.number_of_latest_releases and args.number_of_latest_releases < len(releases):
releases.sort(key=lambda item: datetime.strptime(item["created_at"], "%Y-%m-%dT%H:%M:%SZ"),
reverse=True)
if args.number_of_latest_releases and args.number_of_latest_releases < len(
releases
):
releases.sort(
key=lambda item: datetime.strptime(
item["created_at"], "%Y-%m-%dT%H:%M:%SZ"
),
reverse=True,
)
releases = releases[: args.number_of_latest_releases]
logger.info("Saving the latest {0} releases to disk".format(len(releases)))
else:
@@ -1274,7 +1291,7 @@ def backup_releases(args, repo_cwd, repository, repos_template, include_assets=F
os.path.join(release_assets_cwd, asset["name"]),
get_auth(args, encode=not args.as_app),
as_app=args.as_app,
fine=True if args.token_fine is not None else False
fine=True if args.token_fine is not None else False,
)

View File

@@ -1,9 +1,9 @@
autopep8==2.3.1
black==24.10.0
bleach==6.2.0
certifi==2024.8.30
charset-normalizer==3.4.0
click==8.1.7
certifi==2024.12.14
charset-normalizer==3.4.1
click==8.1.8
colorama==0.4.6
docutils==0.21.2
flake8==7.1.1
@@ -11,7 +11,7 @@ gitchangelog==3.0.4
idna==3.10
importlib-metadata==8.5.0
jaraco.classes==3.4.0
keyring==25.5.0
keyring==25.6.0
markdown-it-py==3.0.0
mccabe==0.7.0
mdurl==0.1.2
@@ -34,6 +34,6 @@ setuptools==75.6.0
six==1.17.0
tqdm==4.67.1
twine==6.0.1
urllib3==2.2.3
urllib3==2.3.0
webencodings==0.5.1
zipp==3.21.0