Skip to content

Commit 132f5ad

Browse files
authored
Merge pull request #27 from aclark4life/main
Misc updates - Show print output - 5.1.x -> 5.2.x - Add mongo-orchestration - Add mongo-arrow - Add mongo-arrow - Add diff to status - Add pymongo-transactions - Clean up status output
2 parents cd2d445 + 142d494 commit 132f5ad

File tree

3 files changed

+36
-22
lines changed

3 files changed

+36
-22
lines changed

django_mongodb_cli/repo.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def test(
368368
]
369369
)
370370
elif repo_name == "mongo-python-driver":
371-
command.extend(["test"])
371+
command.extend(["test", "-s"])
372372

373373
command.extend(modules)
374374
if os.environ.get("DJANGO_SETTINGS_MODULE"):
@@ -402,9 +402,14 @@ def test(
402402
"--reset",
403403
is_flag=True,
404404
)
405+
@click.option(
406+
"-d",
407+
"--diff",
408+
is_flag=True,
409+
)
405410
@click.pass_context
406411
@pass_repo
407-
def status(repo, ctx, repo_names, all_repos, reset):
412+
def status(repo, ctx, repo_names, all_repos, reset, diff):
408413
"""Repository status."""
409414
repos, url_pattern, _ = get_repos("pyproject.toml")
410415
if repo_names:
@@ -415,7 +420,7 @@ def status(repo, ctx, repo_names, all_repos, reset):
415420
os.path.basename(url_pattern.search(repo_entry).group(0))
416421
== repo_name
417422
):
418-
repo_status(repo_entry, url_pattern, repo, reset=reset)
423+
repo_status(repo_entry, url_pattern, repo, reset=reset, diff=diff)
419424
return
420425
else:
421426
not_found.add(repo_name)
@@ -425,7 +430,7 @@ def status(repo, ctx, repo_names, all_repos, reset):
425430
if all_repos:
426431
click.echo(f"Status of {len(repos)} repositories...")
427432
for repo_entry in repos:
428-
repo_status(repo_entry, url_pattern, repo, reset=reset)
433+
repo_status(repo_entry, url_pattern, repo, reset=reset, diff=diff)
429434
return
430435

431436
if ctx.args == []:

django_mongodb_cli/utils.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ def repo_clone(repo_entry, url_pattern, branch_pattern, repo):
137137

138138

139139
def repo_install(clone_path):
140+
if clone_path.endswith("mongo-arrow"):
141+
clone_path = os.path.join(clone_path, "bindings", "python")
140142
if os.path.exists(os.path.join(clone_path, "pyproject.toml")):
141143
subprocess.run([sys.executable, "-m", "pip", "install", "-e", clone_path])
142144
elif os.path.exists(os.path.join(clone_path, "setup.py")):
@@ -177,7 +179,7 @@ def repo_update(repo_entry, url_pattern, repo):
177179
click.echo(f"Skipping {repo_name}: Repository not found at {clone_path}")
178180

179181

180-
def repo_status(repo_entry, url_pattern, repo, reset=False):
182+
def repo_status(repo_entry, url_pattern, repo, reset=False, diff=False):
181183
"""Helper function to update a single repository."""
182184
url_match = url_pattern.search(repo_entry)
183185
if not url_match:
@@ -190,25 +192,29 @@ def repo_status(repo_entry, url_pattern, repo, reset=False):
190192
if os.path.exists(clone_path):
191193
try:
192194
repo = git.Repo(clone_path)
193-
click.echo(click.style(f"Status for {repo_name}:", fg="blue"))
195+
click.echo(f"=== {repo_name} ===")
194196
if reset:
195197
click.echo(click.style(repo.git.reset("--hard"), fg="blue"))
196198
else:
197-
click.echo()
199+
click.echo("Remote URLs:")
198200
click.echo(
199-
click.style(
200-
"".join(
201-
[f"{remote.name}:{remote.url}" for remote in repo.remotes]
202-
),
203-
fg="blue",
204-
)
201+
"".join(
202+
[f"- {remote.name}:{remote.url}" for remote in repo.remotes]
203+
),
205204
)
206-
click.echo()
207-
click.echo(click.style(repo.git.status(), fg="blue"))
208-
click.echo()
209-
click.echo()
210-
click.echo()
205+
click.echo(repo.git.status())
206+
if diff:
207+
diff_output = repo.git.diff()
208+
if diff_output:
209+
click.echo(click.style(diff_output, fg="red"))
210+
else:
211+
click.echo(click.style("No diff output", fg="yellow"))
211212
except git.exc.NoSuchPathError:
212213
click.echo("Not a valid Git repository.")
213214
else:
214-
click.echo(f"Skipping {repo_name}: Repository not found at {clone_path}")
215+
click.echo(
216+
click.style(
217+
f"Skipping {repo_name}: Repository not found at {clone_path}",
218+
fg="yellow",
219+
)
220+
)

pyproject.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,25 @@ packages = ["django_mongodb_cli"]
3535
[tool.django_mongodb_cli]
3636
dev = [
3737
"DublinCityCenterPubFinder @ git+ssh://[email protected]/anaiyaraisin/DublinCityCenterPubFinder",
38-
"django @ git+ssh://[email protected]/mongodb-forks/django@mongodb-5.1.x",
38+
"django @ git+ssh://[email protected]/mongodb-forks/django@mongodb-5.2.x",
3939
"django-allauth @ git+ssh://[email protected]/pennersr/django-allauth@main",
4040
"django-debug-toolbar @ git+ssh://[email protected]/django-commons/django-debug-toolbar@main",
4141
"django-filter @ git+ssh://[email protected]/carltongibson/django-filter@main",
42-
"django-mongodb-app @ git+ssh://[email protected]/mongodb-labs/django-mongodb-app@5.1.x",
42+
"django-mongodb-app @ git+ssh://[email protected]/mongodb-labs/django-mongodb-app@5.2.x",
4343
"django-mongodb-backend @ git+ssh://[email protected]/mongodb/django-mongodb-backend@main",
4444
"django-mongodb-extensions @ git+ssh://[email protected]/mongodb-labs/django-mongodb-extensions@main",
45-
"django-mongodb-project @ git+ssh://[email protected]/mongodb-labs/django-mongodb-project@5.1.x",
45+
"django-mongodb-project @ git+ssh://[email protected]/mongodb-labs/django-mongodb-project@5.2.x",
4646
"django-mongodb-templates @ git+ssh://[email protected]/aclark4life/django-mongodb-templates@main",
4747
"django-rest-framework @ git+ssh://[email protected]/encode/django-rest-framework@main",
4848
"docs @ git+ssh://[email protected]/mongodb/docs@master",
4949
"flask-pymongo @ git+ssh://[email protected]/mongodb-labs/flask-pymongo",
5050
"langchain-mongodb @ git+ssh://[email protected]/langchain-ai/langchain-mongodb@main",
5151
"libmongocrypt @ git+ssh://[email protected]/mongodb-labs/libmongocrypt@main",
52+
"mongo-arrow @ git+ssh://[email protected]/mongodb-labs/mongo-arrow@main",
53+
"mongo-orchestration @ git+ssh://[email protected]/mongodb-labs/mongo-orchestration@master",
5254
"mongo-python-driver @ git+ssh://[email protected]/mongodb/mongo-python-driver@master",
5355
"pymongo-auth-aws @ git+ssh://[email protected]/mongodb/pymongo-auth-aws@main",
56+
"pymongo-transactions @ git+ssh://[email protected]/aclark4life/pymongo-transactions@main",
5457
"specifications @ git+ssh://[email protected]/mongodb/specifications@master",
5558
"wagtail @ git+ssh://[email protected]/mongodb-forks/wagtail@main",
5659
"wagtail-mongodb-project @ git+ssh://[email protected]/mongodb-labs/wagtail-mongodb-project@main",

0 commit comments

Comments
 (0)