mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2025-12-05 16:18:02 +01:00
Compare commits
159 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d860f369e9 | ||
|
|
77ab1bda15 | ||
|
|
4a4a317331 | ||
|
|
5a8e1ac275 | ||
|
|
0de341eab4 | ||
|
|
b0130fdf94 | ||
|
|
b49f399037 | ||
|
|
321414d352 | ||
|
|
413d4381cc | ||
|
|
0110ea40ed | ||
|
|
8d2ef2f528 | ||
|
|
1a79f755a5 | ||
|
|
abf45d5b54 | ||
|
|
fd33037b1c | ||
|
|
87dab293ed | ||
|
|
0244af4e05 | ||
|
|
eca9f0f7df | ||
|
|
afa2a6d587 | ||
|
|
b77ea48d74 | ||
|
|
f378254188 | ||
|
|
83128e986a | ||
|
|
17e4f9a125 | ||
|
|
e59d1e3a68 | ||
|
|
de860ee5a9 | ||
|
|
cb054c2631 | ||
|
|
c142707a90 | ||
|
|
7cccd42ec9 | ||
|
|
9a539b1d6b | ||
|
|
cd2372183e | ||
|
|
bd346de898 | ||
|
|
6e3cbe841a | ||
|
|
8b95f187ad | ||
|
|
ef88248c41 | ||
|
|
0a4decfb3b | ||
|
|
2b9549ffde | ||
|
|
fb2c3ca921 | ||
|
|
4f4785085d | ||
|
|
76895dcf69 | ||
|
|
1d50a4038b | ||
|
|
9d31ccfba9 | ||
|
|
27a1ba2d04 | ||
|
|
f157ea107f | ||
|
|
a129cc759a | ||
|
|
bb551a83f4 | ||
|
|
9b1b4a9ebc | ||
|
|
e6b6eb8bef | ||
|
|
0b3f120e2b | ||
|
|
990249b80b | ||
|
|
cefb226545 | ||
|
|
ea22ffdf26 | ||
|
|
0f21d7b8a4 | ||
|
|
cb33b9bab7 | ||
|
|
68c48cb0b3 | ||
|
|
922a3c5a6e | ||
|
|
d4055eb99c | ||
|
|
d8a330559c | ||
|
|
de93824498 | ||
|
|
2efeaa7580 | ||
|
|
647810a2f0 | ||
|
|
0dfe5c342a | ||
|
|
1d6e1abab1 | ||
|
|
dd2b96b172 | ||
|
|
7a589f1e63 | ||
|
|
92c619cd01 | ||
|
|
9a91dd7733 | ||
|
|
6592bd8196 | ||
|
|
e9e3b18512 | ||
|
|
88148b4c95 | ||
|
|
8448add464 | ||
|
|
5b30b7ebdd | ||
|
|
c3a17710d3 | ||
|
|
4462412ec7 | ||
|
|
8d61538e5e | ||
|
|
4d37ad206f | ||
|
|
1f983863fc | ||
|
|
f0b28567b9 | ||
|
|
77ede50b19 | ||
|
|
97e4fbbacb | ||
|
|
03604cc654 | ||
|
|
73a62fdee1 | ||
|
|
94e1d62ad5 | ||
|
|
54cef11ce7 | ||
|
|
56397eba1c | ||
|
|
9f861efccf | ||
|
|
c1c9ce6dca | ||
|
|
ab18d8aee0 | ||
|
|
9d7d98b19e | ||
|
|
0233bff696 | ||
|
|
6154ceda15 | ||
|
|
9023052e9c | ||
|
|
874c235ba5 | ||
|
|
b7b234d8a5 | ||
|
|
ed160eb0ca | ||
|
|
1d11d62b73 | ||
|
|
9e1cba9817 | ||
|
|
3859a80b7a | ||
|
|
8c12d54898 | ||
|
|
b6b6605acd | ||
|
|
ff5e0aa89c | ||
|
|
79726c360d | ||
|
|
a511bb2b49 | ||
|
|
aedf9b2c66 | ||
|
|
b9e35a50f5 | ||
|
|
d0e239b3ef | ||
|
|
29c9373d9d | ||
|
|
eb8b22c81c | ||
|
|
03739ce1be | ||
|
|
d2bb205b4b | ||
|
|
17141c1bb6 | ||
|
|
d362adbbca | ||
|
|
1e5a90486c | ||
|
|
9b74aff20b | ||
|
|
89df625e04 | ||
|
|
675484a215 | ||
|
|
325f77dcd9 | ||
|
|
f12e9167aa | ||
|
|
816447af19 | ||
|
|
d9e15e2be2 | ||
|
|
534145d178 | ||
|
|
fe162eedd5 | ||
|
|
53a9a22afb | ||
|
|
2aa7d4cf1e | ||
|
|
804843c128 | ||
|
|
5fc27a4d42 | ||
|
|
c8b3f048f5 | ||
|
|
2d98251992 | ||
|
|
050f5f1c17 | ||
|
|
348a238770 | ||
|
|
708b377918 | ||
|
|
6193efb798 | ||
|
|
4b30aaeef3 | ||
|
|
762059d1a6 | ||
|
|
a440bc1522 | ||
|
|
43793c1e5e | ||
|
|
24fac46459 | ||
|
|
c9916e28a4 | ||
|
|
ab4b28cdd4 | ||
|
|
6feb409fc2 | ||
|
|
8bdbc2cee2 | ||
|
|
a4d6272b50 | ||
|
|
7ce61202e5 | ||
|
|
3e82d829e4 | ||
|
|
339ad96876 | ||
|
|
b2a942eb43 | ||
|
|
e8aa38f395 | ||
|
|
86bdb1420c | ||
|
|
2e7f325475 | ||
|
|
8bf62cd932 | ||
|
|
63bf7267a6 | ||
|
|
5612e51153 | ||
|
|
c81bf98627 | ||
|
|
040516325a | ||
|
|
dca9f8051b | ||
|
|
3bc23473b8 | ||
|
|
2c9eb80cf2 | ||
|
|
bb86f0582e | ||
|
|
e8387f9a7f | ||
|
|
39b173f173 | ||
|
|
883c92753d |
399
CHANGES.rst
Normal file
399
CHANGES.rst
Normal file
@@ -0,0 +1,399 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
0.20.1 (2018-09-29)
|
||||
-------------------
|
||||
|
||||
- Clone the specified user's gists, not the authenticated user. [W.
|
||||
Harrison Wright]
|
||||
|
||||
- Clone the specified user's starred repos, not the authenticated user.
|
||||
[W. Harrison Wright]
|
||||
|
||||
0.20.0 (2018-03-24)
|
||||
-------------------
|
||||
|
||||
- Chore: drop Python 2.6. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Feat: simplify release script. [Jose Diaz-Gonzalez]
|
||||
|
||||
0.19.2 (2018-03-24)
|
||||
-------------------
|
||||
|
||||
Fix
|
||||
~~~
|
||||
|
||||
- Cleanup pep8 violations. [Jose Diaz-Gonzalez]
|
||||
|
||||
0.19.0 (2018-03-24)
|
||||
-------------------
|
||||
|
||||
- Add additional output for the current request. [Robin Gloster]
|
||||
|
||||
This is useful to have some progress indication for huge repositories.
|
||||
|
||||
|
||||
- Add option to backup additional PR details. [Robin Gloster]
|
||||
|
||||
Some payload is only included when requesting a single pull request
|
||||
|
||||
|
||||
- Mark string as binary in comparison for skip_existing. [Johannes
|
||||
Bornhold]
|
||||
|
||||
Found out that the flag "--skip-existing" did not work out as expected on Python
|
||||
3.6. Tracked it down to the comparison which has to be against a string of bytes
|
||||
in Python3.
|
||||
|
||||
|
||||
0.18.0 (2018-02-22)
|
||||
-------------------
|
||||
|
||||
- Add option to fetch followers/following JSON data. [Stephen Greene]
|
||||
|
||||
0.17.0 (2018-02-20)
|
||||
-------------------
|
||||
|
||||
- Short circuit gists backup process. [W. Harrison Wright]
|
||||
|
||||
- Formatting. [W. Harrison Wright]
|
||||
|
||||
- Add ability to backup gists. [W. Harrison Wright]
|
||||
|
||||
0.16.0 (2018-01-22)
|
||||
-------------------
|
||||
|
||||
- Change option to --all-starred. [W. Harrison Wright]
|
||||
|
||||
- JK don't update documentation. [W. Harrison Wright]
|
||||
|
||||
- Put starred clone repoistories under a new option. [W. Harrison
|
||||
Wright]
|
||||
|
||||
- Add comment. [W. Harrison Wright]
|
||||
|
||||
- Add ability to clone starred repos. [W. Harrison Wright]
|
||||
|
||||
0.14.1 (2017-10-11)
|
||||
-------------------
|
||||
|
||||
- Fix arg not defined error. [Edward Pfremmer]
|
||||
|
||||
Ref: https://github.com/josegonzalez/python-github-backup/issues/69
|
||||
|
||||
0.14.0 (2017-10-11)
|
||||
-------------------
|
||||
|
||||
- Added a check to see if git-lfs is installed when doing an LFS clone.
|
||||
[pieterclaerhout]
|
||||
|
||||
- Added support for LFS clones. [pieterclaerhout]
|
||||
|
||||
- Add pypi info to readme. [Albert Wang]
|
||||
|
||||
- Explicitly support python 3 in package description. [Albert Wang]
|
||||
|
||||
- Add couple examples to help new users. [Yusuf Tran]
|
||||
|
||||
0.13.2 (2017-05-06)
|
||||
-------------------
|
||||
|
||||
- Fix remotes while updating repository. [Dima Gerasimov]
|
||||
|
||||
0.13.1 (2017-04-11)
|
||||
-------------------
|
||||
|
||||
- Fix error when repository has no updated_at value. [Nicolai Ehemann]
|
||||
|
||||
0.13.0 (2017-04-05)
|
||||
-------------------
|
||||
|
||||
- Add OS check for OSX specific keychain args. [Martin O'Reilly]
|
||||
|
||||
Keychain arguments are only supported on Mac OSX.
|
||||
Added check for operating system so we give a
|
||||
"Keychain arguments are only supported on Mac OSX"
|
||||
error message rather than a "No password item matching the
|
||||
provided name and account could be found in the osx keychain"
|
||||
error message
|
||||
|
||||
|
||||
- Add support for storing PAT in OSX keychain. [Martin O'Reilly]
|
||||
|
||||
Added additional optional arguments and README guidance for storing
|
||||
and accessing a Github personal access token (PAT) in the OSX
|
||||
keychain
|
||||
|
||||
|
||||
0.12.1 (2017-03-27)
|
||||
-------------------
|
||||
|
||||
- Avoid remote branch name churn. [Chris Adams]
|
||||
|
||||
This avoids the backup output having lots of "[new branch]" messages
|
||||
because removing the old remote name removed all of the existing branch
|
||||
references.
|
||||
|
||||
|
||||
- Fix detection of bare git directories. [Andrzej Maczuga]
|
||||
|
||||
0.12.0 (2016-11-22)
|
||||
-------------------
|
||||
|
||||
Fix
|
||||
~~~
|
||||
|
||||
- Properly import version from github_backup package. [Jose Diaz-
|
||||
Gonzalez]
|
||||
|
||||
- Support alternate git status output. [Jose Diaz-Gonzalez]
|
||||
|
||||
Other
|
||||
~~~~~
|
||||
|
||||
- Pep8: E501 line too long (83 > 79 characters) [Jose Diaz-Gonzalez]
|
||||
|
||||
- Pep8: E128 continuation line under-indented for visual indent. [Jose
|
||||
Diaz-Gonzalez]
|
||||
|
||||
- Support archivization using bare git clones. [Andrzej Maczuga]
|
||||
|
||||
- Fix typo, 3x. [Terrell Russell]
|
||||
|
||||
0.11.0 (2016-10-26)
|
||||
-------------------
|
||||
|
||||
- Support --token file:///home/user/token.txt (fixes gh-51) [Björn
|
||||
Dahlgren]
|
||||
|
||||
- Fix some linting. [Albert Wang]
|
||||
|
||||
- Fix byte/string conversion for python 3. [Albert Wang]
|
||||
|
||||
- Support python 3. [Albert Wang]
|
||||
|
||||
- Encode special characters in password. [Remi Rampin]
|
||||
|
||||
- Don't pretend program name is "Github Backup" [Remi Rampin]
|
||||
|
||||
- Don't install over insecure connection. [Remi Rampin]
|
||||
|
||||
The git:// protocol is unauthenticated and unencrypted, and no longer advertised by GitHub. Using HTTPS shouldn't impact performance.
|
||||
|
||||
0.10.3 (2016-08-21)
|
||||
-------------------
|
||||
|
||||
- Fixes #29. [Jonas Michel]
|
||||
|
||||
Reporting an error when the user's rate limit is exceeded causes
|
||||
the script to terminate after resuming execution from a rate limit
|
||||
sleep. Instead of generating an explicit error we just want to
|
||||
inform the user that the script is going to sleep until their rate
|
||||
limit count resets.
|
||||
|
||||
|
||||
- Fixes #29. [Jonas Michel]
|
||||
|
||||
The errors list was not being cleared out after resuming a backup
|
||||
from a rate limit sleep. When the backup was resumed, the non-empty
|
||||
errors list caused the backup to quit after the next `retrieve_data`
|
||||
request.
|
||||
|
||||
|
||||
0.10.2 (2016-08-21)
|
||||
-------------------
|
||||
|
||||
- Add a note regarding git version requirement. [Jose Diaz-Gonzalez]
|
||||
|
||||
Closes #37
|
||||
|
||||
0.10.0 (2016-08-18)
|
||||
-------------------
|
||||
|
||||
- Implement incremental updates. [Robert Bradshaw]
|
||||
|
||||
Guarded with an --incremental flag.
|
||||
|
||||
Stores the time of the last update and only downloads issue and
|
||||
pull request data since this time. All other data is relatively
|
||||
small (likely fetched with a single request) and so is simply
|
||||
re-populated from scratch as before.
|
||||
|
||||
|
||||
0.9.0 (2016-03-29)
|
||||
------------------
|
||||
|
||||
- Fix cloning private repos with basic auth or token. [Kazuki Suda]
|
||||
|
||||
0.8.0 (2016-02-14)
|
||||
------------------
|
||||
|
||||
- Don't store issues which are actually pull requests. [Enrico Tröger]
|
||||
|
||||
This prevents storing pull requests twice since the Github API returns
|
||||
pull requests also as issues. Those issues will be skipped but only if
|
||||
retrieving pull requests is requested as well.
|
||||
Closes #23.
|
||||
|
||||
|
||||
0.7.0 (2016-02-02)
|
||||
------------------
|
||||
|
||||
- Softly fail if not able to read hooks. [Albert Wang]
|
||||
|
||||
- Add note about 2-factor auth. [Albert Wang]
|
||||
|
||||
- Make user repository search go through endpoint capable of reading
|
||||
private repositories. [Albert Wang]
|
||||
|
||||
- Prompt for password if only username given. [Alex Hall]
|
||||
|
||||
0.6.0 (2015-11-10)
|
||||
------------------
|
||||
|
||||
- Force proper remote url. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Improve error handling in case of HTTP errors. [Enrico Tröger]
|
||||
|
||||
In case of a HTTP status code 404, the returned 'r' was never assigned.
|
||||
In case of URL errors which are not timeouts, we probably should bail
|
||||
out.
|
||||
|
||||
|
||||
- Add --hooks to also include web hooks into the backup. [Enrico Tröger]
|
||||
|
||||
- Create the user specified output directory if it does not exist.
|
||||
[Enrico Tröger]
|
||||
|
||||
Fixes #17.
|
||||
|
||||
|
||||
- Add missing auth argument to _get_response() [Enrico Tröger]
|
||||
|
||||
When running unauthenticated and Github starts rate-limiting the client,
|
||||
github-backup crashes because the used auth variable in _get_response()
|
||||
was not available. This change should fix it.
|
||||
|
||||
|
||||
- Add repository URL to error message for non-existing repositories.
|
||||
[Enrico Tröger]
|
||||
|
||||
This makes it easier for the user to identify which repository does not
|
||||
exist or is not initialised, i.e. whether it is the main repository or
|
||||
the wiki repository and which clone URL was used to check.
|
||||
|
||||
|
||||
0.5.0 (2015-10-10)
|
||||
------------------
|
||||
|
||||
- Add release script. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Refactor to both simplify codepath as well as follow PEP8 standards.
|
||||
[Jose Diaz-Gonzalez]
|
||||
|
||||
- Retry 3 times when the connection times out. [Mathijs Jonker]
|
||||
|
||||
- Made unicode output defalut. [Kirill Grushetsky]
|
||||
|
||||
- Import alphabetised. [Kirill Grushetsky]
|
||||
|
||||
- Preserve Unicode characters in the output file. [Kirill Grushetsky]
|
||||
|
||||
Added option to preserve Unicode characters in the output file
|
||||
|
||||
- Josegonzales/python-github-backup#12 Added backup of labels and
|
||||
milestones. [aensley]
|
||||
|
||||
- Fixed indent. [Mathijs Jonker]
|
||||
|
||||
- Skip unitialized repo's. [mjonker-embed]
|
||||
|
||||
These gave me errors which caused mails from crontab.
|
||||
|
||||
- Added prefer-ssh. [mjonker-embed]
|
||||
|
||||
Was needed for my back-up setup, code includes this but readme wasn't updated
|
||||
|
||||
- Retry API requests which failed due to rate-limiting. [Chris Adams]
|
||||
|
||||
This allows operation to continue, albeit at a slower pace,
|
||||
if you have enough data to trigger the API rate limits
|
||||
|
||||
- Logging_subprocess: always log when a command fails. [Chris Adams]
|
||||
|
||||
Previously git clones could fail without any indication
|
||||
unless you edited the source to change `logger=None` to use
|
||||
a configured logger.
|
||||
|
||||
Now a non-zero return code will always output a message to
|
||||
stderr and will display the executed command so it can be
|
||||
rerun for troubleshooting.
|
||||
|
||||
|
||||
- Switch to using ssh_url. [Chris Adams]
|
||||
|
||||
The previous commit used the wrong URL for a private repo. This was
|
||||
masked by the lack of error loging in logging_subprocess (which will be
|
||||
in a separate branch)
|
||||
|
||||
|
||||
- Add an option to prefer checkouts over SSH. [Chris Adams]
|
||||
|
||||
This is really useful with private repos to avoid being nagged
|
||||
for credentials for every repository
|
||||
|
||||
|
||||
- Add pull request support. [Kevin Laude]
|
||||
|
||||
Back up reporitory pull requests by passing the --include-pulls
|
||||
argument. Pull requests are saved to
|
||||
repositories/<repository name>/pulls/<pull request number>.json. Include
|
||||
the --pull-request-comments argument to add review comments to the pull
|
||||
request backup and pass the --pull-request-commits argument to add
|
||||
commits to the pull request backup.
|
||||
|
||||
Pull requests are automatically backed up when the --all argument is
|
||||
uesd.
|
||||
|
||||
|
||||
- Add GitHub Enterprise support. [Kevin Laude]
|
||||
|
||||
Pass the -H or --github-host argument with a GitHub Enterprise hostname
|
||||
to backup from that GitHub enterprise host. If no argument is passed
|
||||
then back up from github.com.
|
||||
|
||||
|
||||
0.2.0 (2014-09-22)
|
||||
------------------
|
||||
|
||||
- Add support for retrieving repositories. Closes #1. [Jose Diaz-
|
||||
Gonzalez]
|
||||
|
||||
- Fix PEP8 violations. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Add authorization to header only if specified by user. [Ioannis
|
||||
Filippidis]
|
||||
|
||||
- Fill out readme more. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Fix import. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Properly name readme. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Create MANIFEST.in. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Create .gitignore. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Create setup.py. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Create requirements.txt. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Create __init__.py. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Create LICENSE.txt. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Create README.md. [Jose Diaz-Gonzalez]
|
||||
|
||||
- Create github-backup. [Jose Diaz-Gonzalez]
|
||||
|
||||
|
||||
115
README.rst
115
README.rst
@@ -2,8 +2,15 @@
|
||||
github-backup
|
||||
=============
|
||||
|
||||
|PyPI| |Python Versions|
|
||||
|
||||
backup a github user or organization
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
- GIT 1.9+
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
@@ -13,22 +20,28 @@ Using PIP via PyPI::
|
||||
|
||||
Using PIP via Github::
|
||||
|
||||
pip install git+git://github.com/josegonzalez/python-github-backup.git#egg=github-backup
|
||||
pip install git+https://github.com/josegonzalez/python-github-backup.git#egg=github-backup
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
CLI Usage is as follows::
|
||||
|
||||
Github Backup [-h] [-u USERNAME] [-p PASSWORD] [-t TOKEN]
|
||||
[-o OUTPUT_DIRECTORY] [--starred] [--watched] [--all]
|
||||
[--issues] [--issue-comments] [--issue-events]
|
||||
[--repositories] [--wikis] [--skip-existing]
|
||||
[-L [LANGUAGES [LANGUAGES ...]]] [-N NAME_REGEX] [-O]
|
||||
[-R REPOSITORY] [-P] [-F] [-v]
|
||||
USER
|
||||
github-backup [-h] [-u USERNAME] [-p PASSWORD] [-t TOKEN]
|
||||
[-o OUTPUT_DIRECTORY] [-i] [--starred] [--all-starred]
|
||||
[--watched] [--followers] [--following] [--all]
|
||||
[--issues] [--issue-comments] [--issue-events] [--pulls]
|
||||
[--pull-comments] [--pull-commits] [--labels] [--hooks]
|
||||
[--milestones] [--repositories] [--bare] [--lfs]
|
||||
[--wikis] [--gists] [--starred-gists] [--skip-existing]
|
||||
[-L [LANGUAGES [LANGUAGES ...]]] [-N NAME_REGEX]
|
||||
[-H GITHUB_HOST] [-O] [-R REPOSITORY] [-P] [-F]
|
||||
[--prefer-ssh] [-v]
|
||||
[--keychain-name OSX_KEYCHAIN_ITEM_NAME]
|
||||
[--keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT]
|
||||
USER
|
||||
|
||||
Backup a github users account
|
||||
Backup a github account
|
||||
|
||||
positional arguments:
|
||||
USER github username
|
||||
@@ -38,29 +51,105 @@ CLI Usage is as follows::
|
||||
-u USERNAME, --username USERNAME
|
||||
username for basic auth
|
||||
-p PASSWORD, --password PASSWORD
|
||||
password for basic auth
|
||||
password for basic auth. If a username is given but
|
||||
not a password, the password will be prompted for.
|
||||
-t TOKEN, --token TOKEN
|
||||
personal access or OAuth token
|
||||
personal access or OAuth token, or path to token
|
||||
(file://...)
|
||||
-o OUTPUT_DIRECTORY, --output-directory OUTPUT_DIRECTORY
|
||||
directory at which to backup the repositories
|
||||
--starred include starred repositories in backup
|
||||
-i, --incremental incremental backup
|
||||
--starred include JSON output of starred repositories in backup
|
||||
--all-starred include starred repositories in backup
|
||||
--watched include watched repositories in backup
|
||||
--followers include JSON output of followers in backup
|
||||
--following include JSON output of following users in backup
|
||||
--all include everything in backup
|
||||
--issues include issues in backup
|
||||
--issue-comments include issue comments in backup
|
||||
--issue-events include issue events in backup
|
||||
--pulls include pull requests in backup
|
||||
--pull-comments include pull request review comments in backup
|
||||
--pull-commits include pull request commits in backup
|
||||
--labels include labels in backup
|
||||
--hooks include hooks in backup (works only when
|
||||
authenticated)
|
||||
--milestones include milestones in backup
|
||||
--repositories include repository clone in backup
|
||||
--bare clone bare repositories
|
||||
--lfs clone LFS repositories (requires Git LFS to be
|
||||
installed, https://git-lfs.github.com)
|
||||
--wikis include wiki clone in backup
|
||||
--gists include gists in backup
|
||||
--starred-gists include starred gists in backup
|
||||
--skip-existing skip project if a backup directory exists
|
||||
-L [LANGUAGES [LANGUAGES ...]], --languages [LANGUAGES [LANGUAGES ...]]
|
||||
only allow these languages
|
||||
-N NAME_REGEX, --name-regex NAME_REGEX
|
||||
python regex to match names against
|
||||
-O, --organization whether or not this is a query for an organization
|
||||
-H GITHUB_HOST, --github-host GITHUB_HOST
|
||||
GitHub Enterprise hostname
|
||||
-O, --organization whether or not this is an organization user
|
||||
-R REPOSITORY, --repository REPOSITORY
|
||||
name of repository to limit backup to
|
||||
-P, --private include private repositories
|
||||
-F, --fork include forked repositories
|
||||
--prefer-ssh Clone repositories using SSH instead of HTTPS
|
||||
-v, --version show program's version number and exit
|
||||
--keychain-name OSX_KEYCHAIN_ITEM_NAME
|
||||
OSX ONLY: name field of password item in OSX keychain
|
||||
that holds the personal access or OAuth token
|
||||
--keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT
|
||||
OSX ONLY: account field of password item in OSX
|
||||
keychain that holds the personal access or OAuth token
|
||||
|
||||
|
||||
The package can be used to backup an *entire* organization or repository, including issues and wikis in the most appropriate format (clones for wikis, json files for issues).
|
||||
|
||||
Authentication
|
||||
==============
|
||||
|
||||
Note: Password-based authentication will fail if you have two-factor authentication enabled.
|
||||
|
||||
Using the Keychain on Mac OSX
|
||||
=============================
|
||||
Note: On Mac OSX the token can be stored securely in the user's keychain. To do this:
|
||||
|
||||
1. Open Keychain from "Applications -> Utilities -> Keychain Access"
|
||||
2. Add a new password item using "File -> New Password Item"
|
||||
3. Enter a name in the "Keychain Item Name" box. You must provide this name to github-backup using the --keychain-name argument.
|
||||
4. Enter an account name in the "Account Name" box, enter your Github username as set above. You must provide this name to github-backup using the --keychain-account argument.
|
||||
5. Enter your Github personal access token in the "Password" box
|
||||
|
||||
Note: When you run github-backup, you will be asked whether you want to allow "security" to use your confidential information stored in your keychain. You have two options:
|
||||
|
||||
1. **Allow:** In this case you will need to click "Allow" each time you run `github-backup`
|
||||
2. **Always Allow:** In this case, you will not be asked for permission when you run `github-backup` in future. This is less secure, but is required if you want to schedule `github-backup` to run automatically
|
||||
|
||||
About Git LFS
|
||||
=============
|
||||
|
||||
When you use the "--lfs" option, you will need to make sure you have Git LFS installed.
|
||||
|
||||
Instructions on how to do this can be found on https://git-lfs.github.com.
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
Backup all repositories::
|
||||
|
||||
export ACCESS_TOKEN=SOME-GITHUB-TOKEN
|
||||
github-backup WhiteHouse --token $ACCESS_TOKEN --organization --output-directory /tmp/white-house --repositories
|
||||
|
||||
Backup a single organization repository with everything else (wiki, pull requests, comments, issues etc)::
|
||||
|
||||
export ACCESS_TOKEN=SOME-GITHUB-TOKEN
|
||||
ORGANIZATION=docker
|
||||
REPO=cli
|
||||
# e.g. git@github.com:docker/cli.git
|
||||
github-backup $ORGANIZATION -P -t $ACCESS_TOKEN -o . --all -O -R $REPO
|
||||
|
||||
.. |PyPI| image:: https://img.shields.io/pypi/v/github-backup.svg
|
||||
:target: https://pypi.python.org/pypi/github-backup/
|
||||
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/github-backup.svg
|
||||
:target: https://github.com/albertyw/github-backup
|
||||
|
||||
952
bin/github-backup
Normal file → Executable file
952
bin/github-backup
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
__version__ = '0.2.0'
|
||||
__version__ = '0.20.1'
|
||||
|
||||
132
release
Executable file
132
release
Executable file
@@ -0,0 +1,132 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $RELEASE_TRACE ]] && set -x
|
||||
|
||||
if [[ ! -f setup.py ]]; then
|
||||
echo -e "${RED}WARNING: Missing setup.py${COLOR_OFF}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PACKAGE_NAME="$(cat setup.py | grep "name='" | head | cut -d "'" -f2)"
|
||||
INIT_PACKAGE_NAME="$(echo "${PACKAGE_NAME//-/_}")"
|
||||
PUBLIC="true"
|
||||
|
||||
# Colors
|
||||
COLOR_OFF="\033[0m" # unsets color to term fg color
|
||||
RED="\033[0;31m" # red
|
||||
GREEN="\033[0;32m" # green
|
||||
YELLOW="\033[0;33m" # yellow
|
||||
MAGENTA="\033[0;35m" # magenta
|
||||
CYAN="\033[0;36m" # cyan
|
||||
|
||||
# ensure wheel is available
|
||||
pip install wheel > /dev/null
|
||||
|
||||
command -v gitchangelog >/dev/null 2>&1 || {
|
||||
echo -e "${RED}WARNING: Missing gitchangelog binary, please run: pip install gitchangelog==2.2.0${COLOR_OFF}\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v rst-lint > /dev/null || {
|
||||
echo -e "${RED}WARNING: Missing rst-lint binary, please run: pip install restructuredtext_lint${COLOR_OFF}\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ "$@" != "major" ]] && [[ "$@" != "minor" ]] && [[ "$@" != "patch" ]]; then
|
||||
echo -e "${RED}WARNING: Invalid release type, must specify 'major', 'minor', or 'patch'${COLOR_OFF}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "\n${GREEN}STARTING RELEASE PROCESS${COLOR_OFF}\n"
|
||||
|
||||
set +e;
|
||||
git status | grep -Eo "working (directory|tree) clean" &> /dev/null
|
||||
if [ ! $? -eq 0 ]; then # working directory is NOT clean
|
||||
echo -e "${RED}WARNING: You have uncomitted changes, you may have forgotten something${COLOR_OFF}\n"
|
||||
exit 1
|
||||
fi
|
||||
set -e;
|
||||
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Updating local copy"
|
||||
git pull -q origin master
|
||||
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Retrieving release versions"
|
||||
|
||||
current_version=$(cat ${INIT_PACKAGE_NAME}/__init__.py |grep '__version__ ='|sed 's/[^0-9.]//g')
|
||||
major=$(echo $current_version | awk '{split($0,a,"."); print a[1]}')
|
||||
minor=$(echo $current_version | awk '{split($0,a,"."); print a[2]}')
|
||||
patch=$(echo $current_version | awk '{split($0,a,"."); print a[3]}')
|
||||
|
||||
if [[ "$@" == "major" ]]; then
|
||||
major=$(($major + 1));
|
||||
minor="0"
|
||||
patch="0"
|
||||
elif [[ "$@" == "minor" ]]; then
|
||||
minor=$(($minor + 1));
|
||||
patch="0"
|
||||
elif [[ "$@" == "patch" ]]; then
|
||||
patch=$(($patch + 1));
|
||||
fi
|
||||
|
||||
next_version="${major}.${minor}.${patch}"
|
||||
|
||||
echo -e "${YELLOW} >${COLOR_OFF} ${MAGENTA}${current_version}${COLOR_OFF} -> ${MAGENTA}${next_version}${COLOR_OFF}"
|
||||
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Ensuring readme passes lint checks (if this fails, run rst-lint)"
|
||||
rst-lint README.rst > /dev/null
|
||||
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Creating necessary temp file"
|
||||
tempfoo=$(basename $0)
|
||||
TMPFILE=$(mktemp /tmp/${tempfoo}.XXXXXX) || {
|
||||
echo -e "${RED}WARNING: Cannot create temp file using mktemp in /tmp dir ${COLOR_OFF}\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
find_this="__version__ = '$current_version'"
|
||||
replace_with="__version__ = '$next_version'"
|
||||
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Updating ${INIT_PACKAGE_NAME}/__init__.py"
|
||||
sed "s/$find_this/$replace_with/" ${INIT_PACKAGE_NAME}/__init__.py > $TMPFILE && mv $TMPFILE ${INIT_PACKAGE_NAME}/__init__.py
|
||||
|
||||
find_this="${PACKAGE_NAME}.git@$current_version"
|
||||
replace_with="${PACKAGE_NAME}.git@$next_version"
|
||||
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Updating README.rst"
|
||||
sed "s/$find_this/$replace_with/" README.rst > $TMPFILE && mv $TMPFILE README.rst
|
||||
|
||||
if [ -f docs/conf.py ]; then
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Updating docs"
|
||||
find_this="version = '${current_version}'"
|
||||
replace_with="version = '${next_version}'"
|
||||
sed "s/$find_this/$replace_with/" docs/conf.py > $TMPFILE && mv $TMPFILE docs/conf.py
|
||||
|
||||
find_this="version = '${current_version}'"
|
||||
replace_with="release = '${next_version}'"
|
||||
sed "s/$find_this/$replace_with/" docs/conf.py > $TMPFILE && mv $TMPFILE docs/conf.py
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Updating CHANGES.rst for new release"
|
||||
version_header="$next_version ($(date +%F))"
|
||||
set +e; dashes=$(yes '-'|head -n ${#version_header}|tr -d '\n') ; set -e
|
||||
gitchangelog |sed "4s/.*/$version_header/"|sed "5s/.*/$dashes/" > $TMPFILE && mv $TMPFILE CHANGES.rst
|
||||
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Adding changed files to git"
|
||||
git add CHANGES.rst README.rst ${INIT_PACKAGE_NAME}/__init__.py
|
||||
if [ -f docs/conf.py ]; then git add docs/conf.py; fi
|
||||
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Creating release"
|
||||
git commit -q -m "Release version $next_version"
|
||||
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Tagging release"
|
||||
git tag -a $next_version -m "Release version $next_version"
|
||||
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Pushing release and tags to github"
|
||||
git push -q origin master && git push -q --tags
|
||||
|
||||
if [[ "$PUBLIC" == "true" ]]; then
|
||||
echo -e "${YELLOW}--->${COLOR_OFF} Creating python release"
|
||||
cp README.rst README
|
||||
python setup.py sdist bdist_wheel upload > /dev/null
|
||||
rm README
|
||||
fi
|
||||
|
||||
echo -e "\n${CYAN}RELEASED VERSION ${next_version}!${COLOR_OFF}\n"
|
||||
3
setup.py
3
setup.py
@@ -37,8 +37,9 @@ setup(
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Topic :: System :: Archiving :: Backup',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Programming Language :: Python :: 2.6',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
],
|
||||
description='backup a github user or organization',
|
||||
long_description=open_file('README.rst').read(),
|
||||
|
||||
Reference in New Issue
Block a user