From 7489826fba6b16c8a296aad39d519caf3813378b Mon Sep 17 00:00:00 2001 From: Konstantin Sorokin Date: Mon, 6 May 2019 13:04:03 +0300 Subject: [PATCH 1/2] add --with-membership option Specifying this option will allow backup projects the user or key is member of. This also include projects filtered by --owned-only option. --- bin/gitlab-backup | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/gitlab-backup b/bin/gitlab-backup index b4a3a80..cd809d0 100755 --- a/bin/gitlab-backup +++ b/bin/gitlab-backup @@ -329,6 +329,10 @@ def parse_args(): action='store_true', dest='owned_only', help='Only backup projects owned by the provided user or key') + parser.add_argument('--with-membership', + action='store_true', + dest='with_membership', + help='Backup projects provided user or key is member of') return parser.parse_args() @@ -343,7 +347,7 @@ def main(): log_info('Create output directory {0}'.format(output_directory)) mkdir_p(output_directory) - items = client.projects.list(as_list=False, owned=args.owned_only) + items = client.projects.list(as_list=False, owned=args.owned_only, membership=args.with_membership) repositories = {} for item in items: repositories[item.path_with_namespace] = item From 4f995cd69974408cf3af24a73e19b80a1a615d6e Mon Sep 17 00:00:00 2001 From: Konstantin Sorokin Date: Mon, 6 May 2019 13:06:46 +0300 Subject: [PATCH 2/2] update README --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index e658bf4..f8cb71a 100644 --- a/README.rst +++ b/README.rst @@ -58,6 +58,7 @@ CLI Usage is as follows:: directory at which to backup the repositories --prefer-ssh Clone repositories using SSH instead of HTTPS --skip-existing skip project if a backup directory exists + --with-membership Backup projects provided user or key is member of .. |PyPI| image:: https://img.shields.io/pypi/v/gitlab-backup.svg