1
0
Fork 0
mirror of https://github.com/clockfort/GitHub-Backup.git synced 2025-03-16 00:00:06 +01:00

Skip forks option implemented

This commit is contained in:
Enrico204 2016-07-22 12:24:42 +02:00
parent 96553fa6e9
commit 2674a8f8fa
2 changed files with 5 additions and 1 deletions

View file

@ -35,6 +35,7 @@ optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
-c, --cron Use this when running from a cron job -c, --cron Use this when running from a cron job
-m, --mirror Create a bare mirror -m, --mirror Create a bare mirror
-f, --skip-forks Skip forks
-g ARGS, --git ARGS Pass extra arguments to git -g ARGS, --git ARGS Pass extra arguments to git
-s SUFFIX, --suffix SUFFIX -s SUFFIX, --suffix SUFFIX
Add suffix to repository directory names Add suffix to repository directory names

View file

@ -43,6 +43,8 @@ def main():
for repo in user_repos: for repo in user_repos:
repo.user = gh.users.get(repo.owner.login) repo.user = gh.users.get(repo.owner.login)
fullrepo = gh.repos.get(repo.owner.login, repo.name)
if not (args.skip_forks and hasattr(fullrepo, 'parent') and hasattr(fullrepo, 'source')):
process_repo(repo, args) process_repo(repo, args)
@ -57,6 +59,7 @@ def init_parser():
parser.add_argument("backupdir", help="The folder where you want your backups to go") parser.add_argument("backupdir", help="The folder where you want your backups to go")
parser.add_argument("-c","--cron", help="Use this when running from a cron job", action="store_true") parser.add_argument("-c","--cron", help="Use this when running from a cron job", action="store_true")
parser.add_argument("-m","--mirror", help="Create a bare mirror", action="store_true") parser.add_argument("-m","--mirror", help="Create a bare mirror", action="store_true")
parser.add_argument("-f","--skip-forks", help="Skip forks", action="store_true")
parser.add_argument("-g","--git", help="Pass extra arguments to git", default="", metavar="ARGS") parser.add_argument("-g","--git", help="Pass extra arguments to git", default="", metavar="ARGS")
parser.add_argument("-s", "--suffix", help="Add suffix to repository directory names", default="") parser.add_argument("-s", "--suffix", help="Add suffix to repository directory names", default="")
parser.add_argument("-p", "--password", help="Authenticate with Github API") parser.add_argument("-p", "--password", help="Authenticate with Github API")