12
12
repo_clone ,
13
13
repo_install ,
14
14
repo_status ,
15
- repo_update ,
16
15
)
17
16
18
17
@@ -68,7 +67,7 @@ def repo(ctx, list_repos):
68
67
@click .pass_context
69
68
@pass_repo
70
69
def clone (repo , ctx , repo_names , all_repos , install ):
71
- """Clone repositories from `pyproject.toml`."""
70
+ """Clone and install repositories from `pyproject.toml`."""
72
71
repos , url_pattern , branch_pattern = get_repos ("pyproject.toml" )
73
72
74
73
if repo_names :
@@ -100,75 +99,39 @@ def clone(repo, ctx, repo_names, all_repos, install):
100
99
click .echo (ctx .get_help ())
101
100
102
101
103
- @repo .command ()
104
- @click .option (
105
- "-a" ,
106
- "--all-repos" ,
107
- is_flag = True ,
108
- )
109
- @click .argument ("repo_names" , nargs = - 1 )
110
- @click .pass_context
111
- @pass_repo
112
- def install (repo , ctx , repo_names , all_repos ):
113
- """Install cloned repositories with `pip install -e`."""
114
-
115
- if repo_names :
116
- for repo_name in repo_names :
117
- clone_path = os .path .join (ctx .obj .home , repo_name )
118
- if os .path .exists (clone_path ):
119
- repo_install (clone_path )
120
- else :
121
- click .echo (f"Repository '{ repo_name } ' not found." )
122
- return
123
-
124
- if all_repos :
125
- repos , url_pattern , branch_pattern = get_repos ("pyproject.toml" )
126
- for repo_entry in repos :
127
- url_match = url_pattern .search (repo_entry )
128
- if url_match :
129
- repo_url = url_match .group (0 )
130
- repo_name = os .path .basename (repo_url )
131
- clone_path = os .path .join (ctx .obj .home , repo_name )
132
- if os .path .exists (clone_path ):
133
- repo_install (clone_path )
134
- return
135
-
136
- if ctx .args == []:
137
- click .echo (ctx .get_help ())
138
-
139
-
140
- @repo .command ()
141
- @click .argument ("repo_names" , nargs = - 1 )
142
- @click .option (
143
- "-a" ,
144
- "--all-repos" ,
145
- is_flag = True ,
146
- )
147
- @click .pass_context
148
- @pass_repo
149
- def update (repo , ctx , repo_names , all_repos ):
150
- """Update cloned repositories with `git pull`."""
151
- repos , url_pattern , _ = get_repos ("pyproject.toml" )
152
- if repo_names :
153
- for repo_name in repo_names :
154
- for repo_entry in repos :
155
- if (
156
- os .path .basename (url_pattern .search (repo_entry ).group (0 ))
157
- == repo_name
158
- ):
159
- repo_update (repo_entry , url_pattern , repo )
160
- return
161
- click .echo (f"Repository '{ repo_name } ' not found." )
162
- return
163
-
164
- if all_repos :
165
- click .echo (f"Updating { len (repos )} repositories..." )
166
- for repo_entry in repos :
167
- repo_update (repo_entry , url_pattern , repo )
168
- return
169
-
170
- if ctx .args == []:
171
- click .echo (ctx .get_help ())
102
+ # @repo.command()
103
+ # @click.argument("repo_names", nargs=-1)
104
+ # @click.option(
105
+ # "-a",
106
+ # "--all-repos",
107
+ # is_flag=True,
108
+ # )
109
+ # @click.pass_context
110
+ # @pass_repo
111
+ # def update(repo, ctx, repo_names, all_repos):
112
+ # """Update cloned repositories with `git pull`."""
113
+ # repos, url_pattern, _ = get_repos("pyproject.toml")
114
+ # if repo_names:
115
+ # for repo_name in repo_names:
116
+ # for repo_entry in repos:
117
+ # if (
118
+ # os.path.basename(url_pattern.search(repo_entry).group(0))
119
+ # == repo_name
120
+ # ):
121
+ # repo_update(repo_entry, url_pattern, repo)
122
+ # return
123
+ # click.echo(f"Repository '{repo_name}' not found.")
124
+ # return
125
+ #
126
+ # if all_repos:
127
+ # click.echo(f"Updating {len(repos)} repositories...")
128
+ # for repo_entry in repos:
129
+ # repo_update(repo_entry, url_pattern, repo)
130
+ # return
131
+ #
132
+ # if ctx.args == []:
133
+ # click.echo(ctx.get_help())
134
+ #
172
135
173
136
174
137
@repo .command (context_settings = {"ignore_unknown_options" : True })
@@ -240,16 +203,14 @@ def makemigrations(
240
203
@click .argument ("modules" , nargs = - 1 )
241
204
@click .option ("-k" , "--keyword" , help = "Filter tests by keyword" )
242
205
@click .option ("-l" , "--list-tests" , help = "List tests" , is_flag = True )
243
- @click .option ("-s" , "--setup" , help = "Setup tests (pymongo only)" , is_flag = True )
244
- @click .option ("--show" , help = "Show settings" , is_flag = True )
206
+ @click .option ("-s" , "--show" , help = "Show settings" , is_flag = True )
245
207
@click .pass_context
246
208
def test (
247
209
ctx ,
248
210
repo_name ,
249
211
modules ,
250
212
keyword ,
251
213
list_tests ,
252
- setup ,
253
214
show ,
254
215
):
255
216
"""
@@ -259,6 +220,7 @@ def test(
259
220
if repo_name :
260
221
# Show test settings
261
222
if show :
223
+ click .echo (f"⚙️ Test settings for 📦 { repo_name } :" )
262
224
if repo_name in test_settings_map .keys ():
263
225
from rich import print
264
226
from black import format_str as format
@@ -286,7 +248,7 @@ def test(
286
248
test_dirs = test_settings_map [repo_name ]["test_dirs" ]
287
249
if list_tests :
288
250
for test_dir in test_dirs :
289
- click .echo (click . style ( f" { test_dir } ", fg = "blue" ) )
251
+ click .echo (f"📂 { test_dir } " )
290
252
try :
291
253
modules = sorted (os .listdir (test_dir ))
292
254
count = 0
@@ -297,9 +259,17 @@ def test(
297
259
and module != "__init__.py"
298
260
):
299
261
if count == len (modules ):
300
- click .echo (f" └── { module } " )
262
+ click .echo (
263
+ click .style (
264
+ f" └── { module } " , fg = "green"
265
+ )
266
+ )
301
267
else :
302
- click .echo (f" ├── { module } " )
268
+ click .echo (
269
+ click .style (
270
+ f" └── { module } " , fg = "green"
271
+ )
272
+ )
303
273
click .echo ()
304
274
except FileNotFoundError :
305
275
click .echo (
@@ -347,6 +317,7 @@ def test(
347
317
"3" ,
348
318
"--debug-sql" ,
349
319
"--noinput" ,
320
+ "--keepdb" ,
350
321
]
351
322
)
352
323
if keyword :
@@ -407,9 +378,19 @@ def test(
407
378
"--diff" ,
408
379
is_flag = True ,
409
380
)
381
+ @click .option (
382
+ "-b" ,
383
+ "--branch" ,
384
+ is_flag = True ,
385
+ )
386
+ @click .option (
387
+ "-u" ,
388
+ "--update" ,
389
+ is_flag = True ,
390
+ )
410
391
@click .pass_context
411
392
@pass_repo
412
- def status (repo , ctx , repo_names , all_repos , reset , diff ):
393
+ def status (repo , ctx , repo_names , all_repos , reset , diff , branch , update ):
413
394
"""Repository status."""
414
395
repos , url_pattern , _ = get_repos ("pyproject.toml" )
415
396
if repo_names :
@@ -420,17 +401,34 @@ def status(repo, ctx, repo_names, all_repos, reset, diff):
420
401
os .path .basename (url_pattern .search (repo_entry ).group (0 ))
421
402
== repo_name
422
403
):
423
- repo_status (repo_entry , url_pattern , repo , reset = reset , diff = diff )
404
+ repo_status (
405
+ repo_entry ,
406
+ url_pattern ,
407
+ repo ,
408
+ reset = reset ,
409
+ diff = diff ,
410
+ branch = branch ,
411
+ update = update ,
412
+ )
424
413
return
425
414
else :
426
415
not_found .add (repo_name )
427
- click .echo (f"Repository '{ not_found .pop ()} ' not found." )
416
+ if not_found :
417
+ click .echo (f"Repository '{ not_found .pop ()} ' not found." )
428
418
return
429
419
430
420
if all_repos :
431
421
click .echo (f"Status of { len (repos )} repositories..." )
432
422
for repo_entry in repos :
433
- repo_status (repo_entry , url_pattern , repo , reset = reset , diff = diff )
423
+ repo_status (
424
+ repo_entry ,
425
+ url_pattern ,
426
+ repo ,
427
+ reset = reset ,
428
+ diff = diff ,
429
+ branch = branch ,
430
+ update = update ,
431
+ )
434
432
return
435
433
436
434
if ctx .args == []:
0 commit comments