diff --git a/README.markdown b/README.markdown index 7b056db..daff30a 100644 --- a/README.markdown +++ b/README.markdown @@ -35,6 +35,7 @@ optional arguments: -h, --help show this help message and exit -c, --cron Use this when running from a cron job -m, --mirror Create a bare mirror + -f, --skip-forks Skip forks -g ARGS, --git ARGS Pass extra arguments to git -s SUFFIX, --suffix SUFFIX Add suffix to repository directory names diff --git a/github-backup.py b/github-backup.py index a92b49f..ef1c8b0 100755 --- a/github-backup.py +++ b/github-backup.py @@ -43,7 +43,9 @@ def main(): for repo in user_repos: repo.user = gh.users.get(repo.owner.login) - process_repo(repo, args) + 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) def init_parser(): @@ -57,6 +59,7 @@ def init_parser(): 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("-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("-s", "--suffix", help="Add suffix to repository directory names", default="") parser.add_argument("-p", "--password", help="Authenticate with Github API")