| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,7 @@ CLI Usage is as follows:: | |||
| 24 | 24 | [-o OUTPUT_DIRECTORY] [--starred] [--watched] [--all] | |
| 25 | 25 | [--issues] [--issue-comments] [--issue-events] [--pulls] | |
| 26 | 26 | [--pull-comments] [--pull-commits] [--repositories] | |
| 27 | - [--wikis] [--skip-existing] | ||
| 27 | + [--wikis] [--labels] [--hooks] [--skip-existing] | ||
| 28 | 28 | [-L [LANGUAGES [LANGUAGES ...]]] [-N NAME_REGEX] | |
| 29 | 29 | [-H GITHUB_HOST] [-O] [-R REPOSITORY] [-P] [-F] | |
| 30 | 30 | [--prefer-ssh] [-v] | |
@@ -57,6 +57,8 @@ CLI Usage is as follows:: | |||
| 57 | 57 | --pull-commits include pull request commits in backup | |
| 58 | 58 | --repositories include repository clone in backup | |
| 59 | 59 | --wikis include wiki clone in backup | |
| 60 | + --labels include labels in backup | ||
| 61 | + --hooks include web hooks in backup (works only when authenticated) | ||
| 60 | 62 | --skip-existing skip project if a backup directory exists | |
| 61 | 63 | -L [LANGUAGES [LANGUAGES ...]], --languages [LANGUAGES [LANGUAGES ...]] | |
| 62 | 64 | only allow these languages | |
@@ -71,6 +73,6 @@ CLI Usage is as follows:: | |||
| 71 | 73 | -F, --fork include forked repositories | |
| 72 | 74 | --prefer-ssh Clone repositories using SSH instead of HTTPS | |
| 73 | 75 | -v, --version show program's version number and exit | |
| 74 | - | ||
| 76 | + | ||
| 75 | 77 | ||
| 76 | 78 | 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). | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -159,6 +159,10 @@ def parse_args(): | |||
| 159 | 159 | action='store_true', | |
| 160 | 160 | dest='include_labels', | |
| 161 | 161 | help='include labels in backup') | |
| 162 | + parser.add_argument('--hooks', | ||
| 163 | + action='store_true', | ||
| 164 | + dest='include_hooks', | ||
| 165 | + help='include hooks in backup (works only when authenticated)') | ||
| 162 | 166 | parser.add_argument('--milestones', | |
| 163 | 167 | action='store_true', | |
| 164 | 168 | dest='include_milestones', | |
@@ -450,6 +454,9 @@ def backup_repositories(args, output_directory, repositories): | |||
| 450 | 454 | if args.include_labels or args.include_everything: | |
| 451 | 455 | backup_labels(args, repo_cwd, repository, repos_template) | |
| 452 | 456 | ||
| 457 | + if args.include_hooks or args.include_everything: | ||
| 458 | + backup_hooks(args, repo_cwd, repository, repos_template) | ||
| 459 | + | ||
| 453 | 460 | ||
| 454 | 461 | def backup_issues(args, repo_cwd, repository, repos_template): | |
| 455 | 462 | has_issues_dir = os.path.isdir('{0}/issues/.git'.format(repo_cwd)) | |
@@ -575,6 +582,22 @@ def backup_labels(args, repo_cwd, repository, repos_template): | |||
| 575 | 582 | label_cwd) | |
| 576 | 583 | ||
| 577 | 584 | ||
| 585 | + def backup_hooks(args, repo_cwd, repository, repos_template): | ||
| 586 | + auth = get_auth(args) | ||
| 587 | + if not auth: | ||
| 588 | + log_info("Skipping hooks since no authentication provided") | ||
| 589 | + return | ||
| 590 | + hook_cwd = os.path.join(repo_cwd, 'hooks') | ||
| 591 | + output_file = '{0}/hooks.json'.format(hook_cwd) | ||
| 592 | + template = '{0}/{1}/hooks'.format(repos_template, | ||
| 593 | + repository['full_name']) | ||
| 594 | + _backup_data(args, | ||
| 595 | + 'hooks', | ||
| 596 | + template, | ||
| 597 | + output_file, | ||
| 598 | + hook_cwd) | ||
| 599 | + | ||
| 600 | + | ||
| 578 | 601 | def fetch_repository(name, remote_url, local_dir, skip_existing=False): | |
| 579 | 602 | clone_exists = os.path.exists(os.path.join(local_dir, '.git')) | |
| 580 | 603 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments