mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2025-12-05 16:18:02 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcf21f7a2e | ||
|
|
36812a332b | ||
|
|
0e0197149e | ||
|
|
eb545c1c2f | ||
|
|
2e72797984 | ||
|
|
68fe29d1e1 | ||
|
|
3dc3691770 | ||
|
|
5b0608ce14 | ||
|
|
1ce8455860 | ||
|
|
dcb89a5c33 | ||
|
|
b0bfffde1a | ||
|
|
0f3aaa6fc2 | ||
|
|
c39ec9c549 |
75
CHANGES.rst
75
CHANGES.rst
@@ -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.
|
||||
|
||||
10
README.rst
10
README.rst
@@ -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"
|
||||
---------------------------
|
||||
|
||||
@@ -1 +1 @@
|
||||
__version__ = "0.47.0"
|
||||
__version__ = "0.48.0"
|
||||
|
||||
@@ -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
|
||||
):
|
||||
@@ -524,7 +529,7 @@ def get_github_host(args):
|
||||
|
||||
|
||||
def read_file_contents(file_uri):
|
||||
return open(file_uri[len(FILE_URI_PREFIX):], "rt").readline().strip()
|
||||
return open(file_uri[len(FILE_URI_PREFIX) :], "rt").readline().strip()
|
||||
|
||||
|
||||
def get_github_repo_url(args, repository):
|
||||
@@ -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,
|
||||
page=1,
|
||||
query_args={},
|
||||
template=url,
|
||||
auth=auth,
|
||||
as_app=as_app,
|
||||
fine=fine)
|
||||
request = _construct_request(
|
||||
per_page=100,
|
||||
page=1,
|
||||
query_args={},
|
||||
template=url,
|
||||
auth=auth,
|
||||
as_app=as_app,
|
||||
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,10 +1255,16 @@ 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)
|
||||
releases = releases[:args.number_of_latest_releases]
|
||||
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:
|
||||
logger.info("Saving {0} releases to disk".format(len(releases)))
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user