githubtakeout 0.1.16__tar.gz → 0.1.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {githubtakeout-0.1.16/src/githubtakeout.egg-info → githubtakeout-0.1.18}/PKG-INFO +17 -14
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/README.md +16 -13
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/pyproject.toml +5 -5
- {githubtakeout-0.1.16 → githubtakeout-0.1.18/src/githubtakeout.egg-info}/PKG-INFO +17 -14
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/src/githubtakeout.py +83 -45
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/src/progress.py +3 -1
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/tests/test_githubtakeout.py +26 -10
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/LICENSE +0 -0
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/setup.cfg +0 -0
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/src/githubtakeout.egg-info/SOURCES.txt +0 -0
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/src/githubtakeout.egg-info/dependency_links.txt +0 -0
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/src/githubtakeout.egg-info/entry_points.txt +0 -0
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/src/githubtakeout.egg-info/requires.txt +0 -0
- {githubtakeout-0.1.16 → githubtakeout-0.1.18}/src/githubtakeout.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: githubtakeout
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.18
|
|
4
4
|
Summary: Backup and archive Git Repos and Gists from GitHub
|
|
5
5
|
Author: Corey Goldberg
|
|
6
6
|
Maintainer: Corey Goldberg
|
|
@@ -101,24 +101,27 @@ the `--token` argument.
|
|
|
101
101
|
## CLI Options:
|
|
102
102
|
|
|
103
103
|
```
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
$ githubtakeout --help
|
|
105
|
+
usage: githubtakeout [-h] [--dir DIR] [--pattern PATTERN] [--skip_pattern PATTERN]
|
|
106
|
+
[--format {tar,zip,none}] [--gists] [--history]
|
|
107
|
+
[--skip_forks] [--keep] [--list] [--token]
|
|
106
108
|
username
|
|
107
109
|
|
|
108
110
|
positional arguments:
|
|
109
|
-
username
|
|
111
|
+
username github username
|
|
110
112
|
|
|
111
113
|
options:
|
|
112
|
-
-h, --help
|
|
113
|
-
--dir DIR
|
|
114
|
-
--pattern PATTERN
|
|
115
|
-
--skip_pattern PATTERN
|
|
116
|
-
--format {tar,zip,none}
|
|
117
|
-
--gists
|
|
118
|
-
--history
|
|
119
|
-
--
|
|
120
|
-
--
|
|
121
|
-
--
|
|
114
|
+
-h, --help show this help message and exit
|
|
115
|
+
--dir DIR output directory (default: .)
|
|
116
|
+
--pattern PATTERN regex matching repo names to include
|
|
117
|
+
--skip_pattern PATTERN regex matching repo names to skip
|
|
118
|
+
--format {tar,zip,none} archive format (default: zip)
|
|
119
|
+
--gists include gists
|
|
120
|
+
--history include commit history and branches (.git directory)
|
|
121
|
+
--skip_forks skip repos that are forks
|
|
122
|
+
--keep keep repos after archiving
|
|
123
|
+
--list list repos only
|
|
124
|
+
--token prompt for auth token
|
|
122
125
|
```
|
|
123
126
|
|
|
124
127
|
## Usage Examples:
|
|
@@ -74,24 +74,27 @@ the `--token` argument.
|
|
|
74
74
|
## CLI Options:
|
|
75
75
|
|
|
76
76
|
```
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
$ githubtakeout --help
|
|
78
|
+
usage: githubtakeout [-h] [--dir DIR] [--pattern PATTERN] [--skip_pattern PATTERN]
|
|
79
|
+
[--format {tar,zip,none}] [--gists] [--history]
|
|
80
|
+
[--skip_forks] [--keep] [--list] [--token]
|
|
79
81
|
username
|
|
80
82
|
|
|
81
83
|
positional arguments:
|
|
82
|
-
username
|
|
84
|
+
username github username
|
|
83
85
|
|
|
84
86
|
options:
|
|
85
|
-
-h, --help
|
|
86
|
-
--dir DIR
|
|
87
|
-
--pattern PATTERN
|
|
88
|
-
--skip_pattern PATTERN
|
|
89
|
-
--format {tar,zip,none}
|
|
90
|
-
--gists
|
|
91
|
-
--history
|
|
92
|
-
--
|
|
93
|
-
--
|
|
94
|
-
--
|
|
87
|
+
-h, --help show this help message and exit
|
|
88
|
+
--dir DIR output directory (default: .)
|
|
89
|
+
--pattern PATTERN regex matching repo names to include
|
|
90
|
+
--skip_pattern PATTERN regex matching repo names to skip
|
|
91
|
+
--format {tar,zip,none} archive format (default: zip)
|
|
92
|
+
--gists include gists
|
|
93
|
+
--history include commit history and branches (.git directory)
|
|
94
|
+
--skip_forks skip repos that are forks
|
|
95
|
+
--keep keep repos after archiving
|
|
96
|
+
--list list repos only
|
|
97
|
+
--token prompt for auth token
|
|
95
98
|
```
|
|
96
99
|
|
|
97
100
|
## Usage Examples:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "githubtakeout"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.18"
|
|
8
8
|
description = "Backup and archive Git Repos and Gists from GitHub"
|
|
9
9
|
license = "MIT"
|
|
10
10
|
license-files = ["LICENSE"]
|
|
@@ -62,13 +62,13 @@ addopts = "-vv" # extra verbose
|
|
|
62
62
|
tmp_path_retention_policy = "none"
|
|
63
63
|
|
|
64
64
|
[tool.black]
|
|
65
|
-
line-length =
|
|
65
|
+
line-length = 88
|
|
66
66
|
target-version = [
|
|
67
67
|
"py312", "py313", "py314"
|
|
68
68
|
]
|
|
69
69
|
|
|
70
70
|
[tool.ruff]
|
|
71
|
-
line-length =
|
|
71
|
+
line-length = 88
|
|
72
72
|
respect-gitignore = true
|
|
73
73
|
target-version = "py312"
|
|
74
74
|
|
|
@@ -84,10 +84,10 @@ fixable = ["ALL"]
|
|
|
84
84
|
|
|
85
85
|
[tool.ruff.format]
|
|
86
86
|
docstring-code-format = true
|
|
87
|
-
docstring-code-line-length =
|
|
87
|
+
docstring-code-line-length = 88
|
|
88
88
|
|
|
89
89
|
[tool.refurb]
|
|
90
|
-
python_version = "3.
|
|
90
|
+
python_version = "3.12"
|
|
91
91
|
enable_all = true
|
|
92
92
|
disable = [
|
|
93
93
|
"FURB104", "FURB107", "FURB147", "FURB173", "FURB183", "FURB184"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: githubtakeout
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.18
|
|
4
4
|
Summary: Backup and archive Git Repos and Gists from GitHub
|
|
5
5
|
Author: Corey Goldberg
|
|
6
6
|
Maintainer: Corey Goldberg
|
|
@@ -101,24 +101,27 @@ the `--token` argument.
|
|
|
101
101
|
## CLI Options:
|
|
102
102
|
|
|
103
103
|
```
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
$ githubtakeout --help
|
|
105
|
+
usage: githubtakeout [-h] [--dir DIR] [--pattern PATTERN] [--skip_pattern PATTERN]
|
|
106
|
+
[--format {tar,zip,none}] [--gists] [--history]
|
|
107
|
+
[--skip_forks] [--keep] [--list] [--token]
|
|
106
108
|
username
|
|
107
109
|
|
|
108
110
|
positional arguments:
|
|
109
|
-
username
|
|
111
|
+
username github username
|
|
110
112
|
|
|
111
113
|
options:
|
|
112
|
-
-h, --help
|
|
113
|
-
--dir DIR
|
|
114
|
-
--pattern PATTERN
|
|
115
|
-
--skip_pattern PATTERN
|
|
116
|
-
--format {tar,zip,none}
|
|
117
|
-
--gists
|
|
118
|
-
--history
|
|
119
|
-
--
|
|
120
|
-
--
|
|
121
|
-
--
|
|
114
|
+
-h, --help show this help message and exit
|
|
115
|
+
--dir DIR output directory (default: .)
|
|
116
|
+
--pattern PATTERN regex matching repo names to include
|
|
117
|
+
--skip_pattern PATTERN regex matching repo names to skip
|
|
118
|
+
--format {tar,zip,none} archive format (default: zip)
|
|
119
|
+
--gists include gists
|
|
120
|
+
--history include commit history and branches (.git directory)
|
|
121
|
+
--skip_forks skip repos that are forks
|
|
122
|
+
--keep keep repos after archiving
|
|
123
|
+
--list list repos only
|
|
124
|
+
--token prompt for auth token
|
|
122
125
|
```
|
|
123
126
|
|
|
124
127
|
## Usage Examples:
|
|
@@ -51,27 +51,28 @@ def add_creds(url, username, token):
|
|
|
51
51
|
return new_url
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
def archive(local_repo_dir, archive_format="zip",
|
|
54
|
+
def archive(local_repo_dir, archive_format="zip", archive_basename=None):
|
|
55
55
|
if archive_format not in ARCHIVE_FORMATS:
|
|
56
56
|
raise ValueError(f"{archive_format} is not a valid archive format")
|
|
57
57
|
if archive_format == "none":
|
|
58
58
|
return None
|
|
59
|
-
|
|
59
|
+
basename = os.path.basename(local_repo_dir)
|
|
60
60
|
extension = "tar.gz" if archive_format == "tar" else archive_format
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
if archive_basename is None:
|
|
62
|
+
archive_name = f"{basename}.{extension}"
|
|
63
|
+
else:
|
|
64
|
+
archive_name = f"{archive_basename}.{extension}"
|
|
64
65
|
parent_dir = os.path.dirname(local_repo_dir)
|
|
65
66
|
archive_path = os.path.join(parent_dir, archive_name)
|
|
66
67
|
logger.info(f"creating archive: {archive_path}")
|
|
67
68
|
if archive_format == "tar":
|
|
68
69
|
with tarfile.open(archive_path, "w:gz") as tar_archive:
|
|
69
|
-
tar_archive.add(local_repo_dir, arcname=
|
|
70
|
+
tar_archive.add(local_repo_dir, arcname=basename)
|
|
70
71
|
elif archive_format == "zip":
|
|
71
72
|
with zipfile.ZipFile(archive_path, "w", zipfile.ZIP_DEFLATED) as zip_archive:
|
|
72
73
|
repo_path = Path(local_repo_dir)
|
|
73
74
|
for entry in repo_path.rglob("*"):
|
|
74
|
-
path = os.path.join(
|
|
75
|
+
path = os.path.join(basename, entry.relative_to(repo_path))
|
|
75
76
|
zip_archive.write(entry, arcname=path)
|
|
76
77
|
return archive_path
|
|
77
78
|
|
|
@@ -90,7 +91,7 @@ def clone(repo_url, local_repo_dir, include_history):
|
|
|
90
91
|
repo = git.Repo.clone_from(
|
|
91
92
|
url=repo_url,
|
|
92
93
|
to_path=local_repo_dir,
|
|
93
|
-
multi_options=["--
|
|
94
|
+
multi_options=["--depth=1"],
|
|
94
95
|
progress=GitProgress(),
|
|
95
96
|
)
|
|
96
97
|
except git.GitCommandError as e:
|
|
@@ -123,7 +124,9 @@ def pull(local_repo_dir):
|
|
|
123
124
|
pass
|
|
124
125
|
|
|
125
126
|
|
|
126
|
-
def get_and_archive_repo(
|
|
127
|
+
def get_and_archive_repo(
|
|
128
|
+
repo_url, local_repo_dir, archive_format, include_history, keep, description=None
|
|
129
|
+
):
|
|
127
130
|
def remove_readonly(func, path, _):
|
|
128
131
|
# This is necessary so rmtree() doesn't fail if there are any readonly
|
|
129
132
|
# dirs/files when trying to delete. This seems to happen after cloning on
|
|
@@ -161,7 +164,15 @@ def get_and_archive_repo(repo_url, local_repo_dir, archive_format, include_histo
|
|
|
161
164
|
shutil.rmtree(git_dir, onexc=remove_readonly)
|
|
162
165
|
except FileNotFoundError:
|
|
163
166
|
pass
|
|
164
|
-
|
|
167
|
+
if description:
|
|
168
|
+
# clean unsafe chars and truncate description to create a useable file name
|
|
169
|
+
clean_name = re.sub(r"[/\\?%*:|\"<>\x7F\x00-\x1F]", "-", description)[:255]
|
|
170
|
+
archive_basename = f"gist - {clean_name}"
|
|
171
|
+
else:
|
|
172
|
+
archive_basename = None
|
|
173
|
+
archive_path = archive(
|
|
174
|
+
local_repo_dir, archive_format, archive_basename=archive_basename
|
|
175
|
+
)
|
|
165
176
|
if archive_path:
|
|
166
177
|
size = convert_size(os.path.getsize(archive_path))
|
|
167
178
|
logger.info(f"archive size: {size}")
|
|
@@ -206,10 +217,19 @@ def get_repos(username, token, include_gists):
|
|
|
206
217
|
if include_gists:
|
|
207
218
|
gists = user.get_gists()
|
|
208
219
|
else:
|
|
209
|
-
gists =
|
|
220
|
+
gists = []
|
|
210
221
|
return repos, gists
|
|
211
222
|
|
|
212
223
|
|
|
224
|
+
def filter_repos(repos, pattern, skip_pattern, skip_forks):
|
|
225
|
+
repos = (repo for repo in repos if re.match(pattern, repo.name))
|
|
226
|
+
if skip_pattern:
|
|
227
|
+
repos = (repo for repo in repos if not re.match(skip_pattern, repo.name))
|
|
228
|
+
if skip_forks:
|
|
229
|
+
repos = (repo for repo in repos if not repo.fork)
|
|
230
|
+
return repos
|
|
231
|
+
|
|
232
|
+
|
|
213
233
|
def get_token(prompt_for_token):
|
|
214
234
|
if prompt_for_token:
|
|
215
235
|
token = getpass.getpass("Token:")
|
|
@@ -230,49 +250,52 @@ def run(
|
|
|
230
250
|
archive_format,
|
|
231
251
|
include_gists,
|
|
232
252
|
include_history,
|
|
253
|
+
skip_forks,
|
|
233
254
|
keep,
|
|
234
255
|
list_only,
|
|
235
256
|
prompt_for_token,
|
|
236
257
|
):
|
|
237
258
|
working_dir = os.path.join(base_dir, "backups")
|
|
238
259
|
token = get_token(prompt_for_token)
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
260
|
+
|
|
261
|
+
all_repos, gists = get_repos(username, token, include_gists)
|
|
262
|
+
repos = filter_repos(all_repos, pattern, skip_pattern, skip_forks)
|
|
263
|
+
num_repos = sum(1 for repo in repos)
|
|
264
|
+
num_gists = sum(1 for gist in gists)
|
|
265
|
+
|
|
266
|
+
# we have to fetch the repos again because we exhaust the generator
|
|
267
|
+
# when counting repos above
|
|
268
|
+
all_repos, gists = get_repos(username, token, include_gists)
|
|
269
|
+
repos = filter_repos(all_repos, pattern, skip_pattern, skip_forks)
|
|
247
270
|
if not list_only:
|
|
248
271
|
logger.info(f"creating archives in: {working_dir}\n")
|
|
249
272
|
logger.info(f"found {num_repos} repos for user '{username}':\n")
|
|
250
273
|
for repo in repos:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
[
|
|
261
|
-
gist
|
|
262
|
-
for gist in gists
|
|
263
|
-
if re.match(pattern, gist.id) and not (re.match(skip_pattern, gist.id) if skip_pattern else False)
|
|
264
|
-
]
|
|
265
|
-
)
|
|
274
|
+
local_repo_dir = os.path.join(working_dir, repo.name)
|
|
275
|
+
url = add_creds(repo.clone_url, username, token)
|
|
276
|
+
if list_only:
|
|
277
|
+
logger.info(f"{username}/{repo.name}")
|
|
278
|
+
else:
|
|
279
|
+
get_and_archive_repo(
|
|
280
|
+
url, local_repo_dir, archive_format, include_history, keep
|
|
281
|
+
)
|
|
282
|
+
if include_gists:
|
|
266
283
|
logger.info("")
|
|
267
284
|
logger.info(f"found {num_gists} gists for user '{username}':\n")
|
|
268
285
|
for gist in gists:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
286
|
+
local_repo_dir = os.path.join(working_dir, gist.id)
|
|
287
|
+
url = add_creds(gist.git_pull_url, username, token)
|
|
288
|
+
if list_only:
|
|
289
|
+
logger.info(f"{username}/{gist.id}\n - {gist.description}")
|
|
290
|
+
else:
|
|
291
|
+
get_and_archive_repo(
|
|
292
|
+
url,
|
|
293
|
+
local_repo_dir,
|
|
294
|
+
archive_format,
|
|
295
|
+
include_history,
|
|
296
|
+
keep,
|
|
297
|
+
description=gist.description,
|
|
298
|
+
)
|
|
276
299
|
|
|
277
300
|
|
|
278
301
|
def main():
|
|
@@ -305,16 +328,30 @@ def main():
|
|
|
305
328
|
default="zip",
|
|
306
329
|
help="archive format (default: %(default)s)",
|
|
307
330
|
)
|
|
308
|
-
parser.add_argument(
|
|
331
|
+
parser.add_argument(
|
|
332
|
+
"--gists", action="store_true", default=False, help="include gists"
|
|
333
|
+
)
|
|
309
334
|
parser.add_argument(
|
|
310
335
|
"--history",
|
|
311
336
|
action="store_true",
|
|
312
337
|
default=False,
|
|
313
338
|
help="include commit history and branches (.git directory)",
|
|
314
339
|
)
|
|
315
|
-
parser.add_argument(
|
|
316
|
-
|
|
317
|
-
|
|
340
|
+
parser.add_argument(
|
|
341
|
+
"--skip_forks",
|
|
342
|
+
action="store_true",
|
|
343
|
+
default=False,
|
|
344
|
+
help="skip repos that are forks",
|
|
345
|
+
)
|
|
346
|
+
parser.add_argument(
|
|
347
|
+
"--keep", action="store_true", default=False, help="keep repos after archiving"
|
|
348
|
+
)
|
|
349
|
+
parser.add_argument(
|
|
350
|
+
"--list", action="store_true", default=False, help="list repos only"
|
|
351
|
+
)
|
|
352
|
+
parser.add_argument(
|
|
353
|
+
"--token", action="store_true", default=False, help="prompt for auth token"
|
|
354
|
+
)
|
|
318
355
|
args = parser.parse_args()
|
|
319
356
|
try:
|
|
320
357
|
run(
|
|
@@ -325,6 +362,7 @@ def main():
|
|
|
325
362
|
archive_format=args.format,
|
|
326
363
|
include_gists=args.gists,
|
|
327
364
|
include_history=args.history,
|
|
365
|
+
skip_forks=args.skip_forks,
|
|
328
366
|
keep=args.keep,
|
|
329
367
|
list_only=args.list,
|
|
330
368
|
prompt_for_token=args.token,
|
|
@@ -20,7 +20,9 @@ class GitProgress(git.RemoteProgress):
|
|
|
20
20
|
"RESOLVING",
|
|
21
21
|
"WRITING",
|
|
22
22
|
]
|
|
23
|
-
OP_CODE_MAP = {
|
|
23
|
+
OP_CODE_MAP = {
|
|
24
|
+
getattr(git.RemoteProgress, _op_code): _op_code for _op_code in OP_CODES
|
|
25
|
+
}
|
|
24
26
|
|
|
25
27
|
def __init__(self):
|
|
26
28
|
super().__init__()
|
|
@@ -15,10 +15,15 @@ def require_token():
|
|
|
15
15
|
load_dotenv()
|
|
16
16
|
required = "GITHUB_TOKEN"
|
|
17
17
|
if not os.getenv(required):
|
|
18
|
-
pytest.skip(
|
|
18
|
+
pytest.skip(
|
|
19
|
+
reason=f"{required} environment variable or .env file is "
|
|
20
|
+
"required to avoid rate limiting"
|
|
21
|
+
)
|
|
19
22
|
|
|
20
23
|
|
|
21
|
-
@pytest.mark.skipif(
|
|
24
|
+
@pytest.mark.skipif(
|
|
25
|
+
os.getenv("GITHUB_TOKEN"), reason="GITHUB_TOKEN required to avoid rate limiting"
|
|
26
|
+
)
|
|
22
27
|
def test_run_list_1_match(tmp_path, caplog):
|
|
23
28
|
caplog.set_level("INFO")
|
|
24
29
|
repo = "githubtakeout"
|
|
@@ -30,13 +35,14 @@ def test_run_list_1_match(tmp_path, caplog):
|
|
|
30
35
|
archive_format="none",
|
|
31
36
|
include_gists=False,
|
|
32
37
|
include_history=False,
|
|
38
|
+
skip_forks=False,
|
|
33
39
|
keep=False,
|
|
34
40
|
list_only=True,
|
|
35
41
|
prompt_for_token=False,
|
|
36
42
|
)
|
|
37
43
|
assert "creating archives" not in caplog.text
|
|
38
44
|
assert f"found 1 repos for user '{USER}'" in caplog.text
|
|
39
|
-
assert "gists"
|
|
45
|
+
assert not re.search(r"found \d* gists", caplog.text)
|
|
40
46
|
assert f"{USER}/{repo}" in caplog.text
|
|
41
47
|
assert not Path(tmp_path / "backups" / repo).exists()
|
|
42
48
|
|
|
@@ -52,13 +58,14 @@ def test_run_list_0_match(tmp_path, caplog):
|
|
|
52
58
|
archive_format="none",
|
|
53
59
|
include_gists=False,
|
|
54
60
|
include_history=False,
|
|
61
|
+
skip_forks=False,
|
|
55
62
|
keep=False,
|
|
56
63
|
list_only=True,
|
|
57
64
|
prompt_for_token=False,
|
|
58
65
|
)
|
|
59
66
|
assert "creating archives" not in caplog.text
|
|
60
|
-
assert
|
|
61
|
-
assert "gists"
|
|
67
|
+
assert "found 0 repos" in caplog.text
|
|
68
|
+
assert not re.search(r"found \d* gists", caplog.text)
|
|
62
69
|
assert not Path(tmp_path / "backups" / repo).exists()
|
|
63
70
|
|
|
64
71
|
|
|
@@ -73,13 +80,14 @@ def test_run_list_0_match_with_gists(tmp_path, caplog):
|
|
|
73
80
|
archive_format="none",
|
|
74
81
|
include_gists=True,
|
|
75
82
|
include_history=False,
|
|
83
|
+
skip_forks=False,
|
|
76
84
|
keep=False,
|
|
77
85
|
list_only=True,
|
|
78
86
|
prompt_for_token=False,
|
|
79
87
|
)
|
|
80
88
|
assert "creating archives" not in caplog.text
|
|
81
|
-
assert
|
|
82
|
-
assert
|
|
89
|
+
assert "found 0 repos" in caplog.text
|
|
90
|
+
assert re.search(r"found \d* gists", caplog.text)
|
|
83
91
|
assert not Path(tmp_path / "backups" / repo).exists()
|
|
84
92
|
|
|
85
93
|
|
|
@@ -89,16 +97,17 @@ def test_run_list_skip_all(tmp_path, caplog):
|
|
|
89
97
|
username=USER,
|
|
90
98
|
base_dir=tmp_path,
|
|
91
99
|
pattern=".*",
|
|
92
|
-
skip_pattern="
|
|
100
|
+
skip_pattern=".*",
|
|
93
101
|
archive_format="none",
|
|
94
102
|
include_gists=False,
|
|
95
103
|
include_history=False,
|
|
104
|
+
skip_forks=False,
|
|
96
105
|
keep=False,
|
|
97
106
|
list_only=True,
|
|
98
107
|
prompt_for_token=False,
|
|
99
108
|
)
|
|
100
109
|
assert "creating archives" not in caplog.text
|
|
101
|
-
assert
|
|
110
|
+
assert "found 0 repos" in caplog.text
|
|
102
111
|
|
|
103
112
|
|
|
104
113
|
@pytest.mark.parametrize("archive_format", ["zip", "tar"])
|
|
@@ -114,6 +123,7 @@ def test_run_archive_1_match(archive_format, tmp_path, caplog):
|
|
|
114
123
|
archive_format=archive_format,
|
|
115
124
|
include_gists=False,
|
|
116
125
|
include_history=False,
|
|
126
|
+
skip_forks=False,
|
|
117
127
|
keep=False,
|
|
118
128
|
list_only=False,
|
|
119
129
|
prompt_for_token=False,
|
|
@@ -146,6 +156,7 @@ def test_run_no_archive_1_match_with_history(tmp_path, caplog):
|
|
|
146
156
|
archive_format="none",
|
|
147
157
|
include_gists=False,
|
|
148
158
|
include_history=True,
|
|
159
|
+
skip_forks=False,
|
|
149
160
|
keep=False,
|
|
150
161
|
list_only=False,
|
|
151
162
|
prompt_for_token=False,
|
|
@@ -176,6 +187,7 @@ def test_run_no_archive_1_match_without_history(tmp_path, caplog):
|
|
|
176
187
|
archive_format="none",
|
|
177
188
|
include_gists=False,
|
|
178
189
|
include_history=False,
|
|
190
|
+
skip_forks=False,
|
|
179
191
|
keep=False, # this doesn't matter when archive_format is "none"
|
|
180
192
|
list_only=False,
|
|
181
193
|
prompt_for_token=False,
|
|
@@ -206,6 +218,7 @@ def test_run_archive_1_match_with_history_pull_with_keep(tmp_path, caplog):
|
|
|
206
218
|
archive_format="none",
|
|
207
219
|
include_gists=False,
|
|
208
220
|
include_history=True,
|
|
221
|
+
skip_forks=False,
|
|
209
222
|
keep=True,
|
|
210
223
|
list_only=False,
|
|
211
224
|
prompt_for_token=False,
|
|
@@ -229,6 +242,7 @@ def test_run_archive_1_match_with_history_pull_with_keep(tmp_path, caplog):
|
|
|
229
242
|
archive_format="zip",
|
|
230
243
|
include_gists=False,
|
|
231
244
|
include_history=True,
|
|
245
|
+
skip_forks=False,
|
|
232
246
|
keep=True,
|
|
233
247
|
list_only=False,
|
|
234
248
|
prompt_for_token=False,
|
|
@@ -236,7 +250,9 @@ def test_run_archive_1_match_with_history_pull_with_keep(tmp_path, caplog):
|
|
|
236
250
|
assert f"found 1 repos for user '{USER}'" in caplog.text
|
|
237
251
|
assert "gists" not in caplog.text
|
|
238
252
|
assert not re.search(f"cloning repo: {USER}/{repo}.git to: .*backups", caplog.text)
|
|
239
|
-
assert re.search(
|
|
253
|
+
assert re.search(
|
|
254
|
+
f"pulling changes from repo: {USER}/{repo}.git to: .*backups", caplog.text
|
|
255
|
+
)
|
|
240
256
|
assert "creating archive:" in caplog.text
|
|
241
257
|
assert "archive size:" in caplog.text
|
|
242
258
|
assert "deleting repo" not in caplog.text
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{githubtakeout-0.1.16 → githubtakeout-0.1.18}/src/githubtakeout.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|