1212 repo_clone ,
1313 repo_install ,
1414 repo_status ,
15- repo_update ,
1615)
1716
1817
@@ -68,7 +67,7 @@ def repo(ctx, list_repos):
6867@click .pass_context
6968@pass_repo
7069def clone (repo , ctx , repo_names , all_repos , install ):
71- """Clone repositories from `pyproject.toml`."""
70+ """Clone and install repositories from `pyproject.toml`."""
7271 repos , url_pattern , branch_pattern = get_repos ("pyproject.toml" )
7372
7473 if repo_names :
@@ -100,75 +99,39 @@ def clone(repo, ctx, repo_names, all_repos, install):
10099 click .echo (ctx .get_help ())
101100
102101
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+ #
172135
173136
174137@repo .command (context_settings = {"ignore_unknown_options" : True })
@@ -240,16 +203,14 @@ def makemigrations(
240203@click .argument ("modules" , nargs = - 1 )
241204@click .option ("-k" , "--keyword" , help = "Filter tests by keyword" )
242205@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 )
245207@click .pass_context
246208def test (
247209 ctx ,
248210 repo_name ,
249211 modules ,
250212 keyword ,
251213 list_tests ,
252- setup ,
253214 show ,
254215):
255216 """
@@ -259,6 +220,7 @@ def test(
259220 if repo_name :
260221 # Show test settings
261222 if show :
223+ click .echo (f"⚙️ Test settings for 📦 { repo_name } :" )
262224 if repo_name in test_settings_map .keys ():
263225 from rich import print
264226 from black import format_str as format
@@ -286,7 +248,7 @@ def test(
286248 test_dirs = test_settings_map [repo_name ]["test_dirs" ]
287249 if list_tests :
288250 for test_dir in test_dirs :
289- click .echo (click . style ( f" { test_dir } ", fg = "blue" ) )
251+ click .echo (f"📂 { test_dir } " )
290252 try :
291253 modules = sorted (os .listdir (test_dir ))
292254 count = 0
@@ -297,9 +259,17 @@ def test(
297259 and module != "__init__.py"
298260 ):
299261 if count == len (modules ):
300- click .echo (f" └── { module } " )
262+ click .echo (
263+ click .style (
264+ f" └── { module } " , fg = "green"
265+ )
266+ )
301267 else :
302- click .echo (f" ├── { module } " )
268+ click .echo (
269+ click .style (
270+ f" └── { module } " , fg = "green"
271+ )
272+ )
303273 click .echo ()
304274 except FileNotFoundError :
305275 click .echo (
@@ -347,6 +317,7 @@ def test(
347317 "3" ,
348318 "--debug-sql" ,
349319 "--noinput" ,
320+ "--keepdb" ,
350321 ]
351322 )
352323 if keyword :
@@ -407,9 +378,19 @@ def test(
407378 "--diff" ,
408379 is_flag = True ,
409380)
381+ @click .option (
382+ "-b" ,
383+ "--branch" ,
384+ is_flag = True ,
385+ )
386+ @click .option (
387+ "-u" ,
388+ "--update" ,
389+ is_flag = True ,
390+ )
410391@click .pass_context
411392@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 ):
413394 """Repository status."""
414395 repos , url_pattern , _ = get_repos ("pyproject.toml" )
415396 if repo_names :
@@ -420,17 +401,34 @@ def status(repo, ctx, repo_names, all_repos, reset, diff):
420401 os .path .basename (url_pattern .search (repo_entry ).group (0 ))
421402 == repo_name
422403 ):
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+ )
424413 return
425414 else :
426415 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." )
428418 return
429419
430420 if all_repos :
431421 click .echo (f"Status of { len (repos )} repositories..." )
432422 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+ )
434432 return
435433
436434 if ctx .args == []:
0 commit comments