mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2025-12-05 16:18:02 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fac8e4274f | ||
|
|
17fee66f31 | ||
|
|
a56d27dd8b | ||
|
|
e57873b6dd | ||
|
|
2658b039a1 | ||
|
|
fd684a71fb | ||
|
|
bacd77030b | ||
|
|
b73079daf2 | ||
|
|
eca8a70666 | ||
|
|
e74765ba7f |
16
CHANGES.rst
16
CHANGES.rst
@@ -1,9 +1,23 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
0.24.0 (2019-06-27)
|
0.26.0 (2019-09-23)
|
||||||
-------------------
|
-------------------
|
||||||
------------------------
|
------------------------
|
||||||
|
- Workaround gist clone in `--prefer-ssh` mode. [Vladislav Yarmak]
|
||||||
|
- Create PULL_REQUEST.md. [Jose Diaz-Gonzalez]
|
||||||
|
- Create ISSUE_TEMPLATE.md. [Jose Diaz-Gonzalez]
|
||||||
|
|
||||||
|
|
||||||
|
0.25.0 (2019-07-03)
|
||||||
|
-------------------
|
||||||
|
- Issue 119: Change retrieve_data to be a generator. [2a]
|
||||||
|
|
||||||
|
See issue #119.
|
||||||
|
|
||||||
|
|
||||||
|
0.24.0 (2019-06-27)
|
||||||
|
-------------------
|
||||||
- QKT-45: include assets - update readme. [Ethan Timm]
|
- QKT-45: include assets - update readme. [Ethan Timm]
|
||||||
|
|
||||||
update readme with flag information for including assets alongside their respective releases
|
update readme with flag information for including assets alongside their respective releases
|
||||||
|
|||||||
13
ISSUE_TEMPLATE.md
Normal file
13
ISSUE_TEMPLATE.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Important notice regarding filed issues
|
||||||
|
|
||||||
|
This project already fills my needs, and as such I have no real reason to continue it's development. This project is otherwise provided as is, and no support is given.
|
||||||
|
|
||||||
|
If pull requests implementing bug fixes or enhancements are pushed, I am happy to review and merge them (time permitting).
|
||||||
|
|
||||||
|
If you wish to have a bug fixed, you have a few options:
|
||||||
|
|
||||||
|
- Fix it yourself.
|
||||||
|
- File a bug and hope someone else fixes it for you.
|
||||||
|
- Pay me to fix it (my rate is $200 an hour, minimum 1 hour, contact me via my [github email address](https://github.com/josegonzalez) if you want to go this route).
|
||||||
|
|
||||||
|
In all cases, feel free to file an issue, they may be of help to others in the future.
|
||||||
7
PULL_REQUEST.md
Normal file
7
PULL_REQUEST.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Important notice regarding filed pull requests
|
||||||
|
|
||||||
|
This project already fills my needs, and as such I have no real reason to continue it's development. This project is otherwise provided as is, and no support is given.
|
||||||
|
|
||||||
|
I will attempt to review pull requests at _my_ earliest convenience. If I am unable to get to your pull request in a timely fashion, it is what it is. This repository does not pay any bills, and I am not required to merge any pull request from any individual.
|
||||||
|
|
||||||
|
If you wish to jump my personal priority queue, you may pay me for my time to review. My rate is $200 an hour - minimum 1 hour - feel free contact me via my github email address if you want to go this route.
|
||||||
@@ -4,6 +4,8 @@ github-backup
|
|||||||
|
|
||||||
|PyPI| |Python Versions|
|
|PyPI| |Python Versions|
|
||||||
|
|
||||||
|
This project is considered feature complete for the primary maintainer. If you would like a bugfix or enhancement and cannot sponsor the work, pull requests are welcome. Feel free to contact the maintainer for consulting estimates if desired.
|
||||||
|
|
||||||
backup a github user or organization
|
backup a github user or organization
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
|
|||||||
@@ -387,12 +387,12 @@ def get_github_host(args):
|
|||||||
|
|
||||||
|
|
||||||
def get_github_repo_url(args, repository):
|
def get_github_repo_url(args, repository):
|
||||||
if args.prefer_ssh:
|
|
||||||
return repository['ssh_url']
|
|
||||||
|
|
||||||
if repository.get('is_gist'):
|
if repository.get('is_gist'):
|
||||||
return repository['git_pull_url']
|
return repository['git_pull_url']
|
||||||
|
|
||||||
|
if args.prefer_ssh:
|
||||||
|
return repository['ssh_url']
|
||||||
|
|
||||||
auth = get_auth(args, False)
|
auth = get_auth(args, False)
|
||||||
if auth:
|
if auth:
|
||||||
repo_url = 'https://{0}@{1}/{2}/{3}.git'.format(
|
repo_url = 'https://{0}@{1}/{2}/{3}.git'.format(
|
||||||
@@ -406,12 +406,11 @@ def get_github_repo_url(args, repository):
|
|||||||
return repo_url
|
return repo_url
|
||||||
|
|
||||||
|
|
||||||
def retrieve_data(args, template, query_args=None, single_request=False):
|
def retrieve_data_gen(args, template, query_args=None, single_request=False):
|
||||||
auth = get_auth(args)
|
auth = get_auth(args)
|
||||||
query_args = get_query_args(query_args)
|
query_args = get_query_args(query_args)
|
||||||
per_page = 100
|
per_page = 100
|
||||||
page = 0
|
page = 0
|
||||||
data = []
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
page = page + 1
|
page = page + 1
|
||||||
@@ -438,11 +437,12 @@ def retrieve_data(args, template, query_args=None, single_request=False):
|
|||||||
response = json.loads(r.read().decode('utf-8'))
|
response = json.loads(r.read().decode('utf-8'))
|
||||||
if len(errors) == 0:
|
if len(errors) == 0:
|
||||||
if type(response) == list:
|
if type(response) == list:
|
||||||
data.extend(response)
|
for resp in response:
|
||||||
|
yield resp
|
||||||
if len(response) < per_page:
|
if len(response) < per_page:
|
||||||
break
|
break
|
||||||
elif type(response) == dict and single_request:
|
elif type(response) == dict and single_request:
|
||||||
data.append(response)
|
yield response
|
||||||
|
|
||||||
if len(errors) > 0:
|
if len(errors) > 0:
|
||||||
log_error(errors)
|
log_error(errors)
|
||||||
@@ -450,8 +450,8 @@ def retrieve_data(args, template, query_args=None, single_request=False):
|
|||||||
if single_request:
|
if single_request:
|
||||||
break
|
break
|
||||||
|
|
||||||
return data
|
def retrieve_data(args, template, query_args=None, single_request=False):
|
||||||
|
return list(retrieve_data_gen(args, template, query_args, single_request))
|
||||||
|
|
||||||
def get_query_args(query_args=None):
|
def get_query_args(query_args=None):
|
||||||
if not query_args:
|
if not query_args:
|
||||||
@@ -836,18 +836,21 @@ def backup_pulls(args, repo_cwd, repository, repos_template):
|
|||||||
pull_states = ['open', 'closed']
|
pull_states = ['open', 'closed']
|
||||||
for pull_state in pull_states:
|
for pull_state in pull_states:
|
||||||
query_args['state'] = pull_state
|
query_args['state'] = pull_state
|
||||||
# It'd be nice to be able to apply the args.since filter here...
|
_pulls = retrieve_data_gen(args,
|
||||||
_pulls = retrieve_data(args,
|
|
||||||
_pulls_template,
|
_pulls_template,
|
||||||
query_args=query_args)
|
query_args=query_args)
|
||||||
for pull in _pulls:
|
for pull in _pulls:
|
||||||
|
if args.since and pull['updated_at'] < args.since:
|
||||||
|
break
|
||||||
if not args.since or pull['updated_at'] >= args.since:
|
if not args.since or pull['updated_at'] >= args.since:
|
||||||
pulls[pull['number']] = pull
|
pulls[pull['number']] = pull
|
||||||
else:
|
else:
|
||||||
_pulls = retrieve_data(args,
|
_pulls = retrieve_data_gen(args,
|
||||||
_pulls_template,
|
_pulls_template,
|
||||||
query_args=query_args)
|
query_args=query_args)
|
||||||
for pull in _pulls:
|
for pull in _pulls:
|
||||||
|
if args.since and pull['updated_at'] < args.since:
|
||||||
|
break
|
||||||
if not args.since or pull['updated_at'] >= args.since:
|
if not args.since or pull['updated_at'] >= args.since:
|
||||||
pulls[pull['number']] = retrieve_data(
|
pulls[pull['number']] = retrieve_data(
|
||||||
args,
|
args,
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
__version__ = '0.24.0'
|
__version__ = '0.26.0'
|
||||||
|
|||||||
Reference in New Issue
Block a user