Skip to content

Misc updates #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions django_mongodb_cli/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def test(
]
)
elif repo_name == "mongo-python-driver":
command.extend(["test"])
command.extend(["test", "-s"])

command.extend(modules)
if os.environ.get("DJANGO_SETTINGS_MODULE"):
Expand Down Expand Up @@ -402,9 +402,14 @@ def test(
"--reset",
is_flag=True,
)
@click.option(
"-d",
"--diff",
is_flag=True,
)
@click.pass_context
@pass_repo
def status(repo, ctx, repo_names, all_repos, reset):
def status(repo, ctx, repo_names, all_repos, reset, diff):
"""Repository status."""
repos, url_pattern, _ = get_repos("pyproject.toml")
if repo_names:
Expand All @@ -415,7 +420,7 @@ def status(repo, ctx, repo_names, all_repos, reset):
os.path.basename(url_pattern.search(repo_entry).group(0))
== repo_name
):
repo_status(repo_entry, url_pattern, repo, reset=reset)
repo_status(repo_entry, url_pattern, repo, reset=reset, diff=diff)
return
else:
not_found.add(repo_name)
Expand All @@ -425,7 +430,7 @@ def status(repo, ctx, repo_names, all_repos, reset):
if all_repos:
click.echo(f"Status of {len(repos)} repositories...")
for repo_entry in repos:
repo_status(repo_entry, url_pattern, repo, reset=reset)
repo_status(repo_entry, url_pattern, repo, reset=reset, diff=diff)
return

if ctx.args == []:
Expand Down
36 changes: 21 additions & 15 deletions django_mongodb_cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ def repo_clone(repo_entry, url_pattern, branch_pattern, repo):


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


def repo_status(repo_entry, url_pattern, repo, reset=False):
def repo_status(repo_entry, url_pattern, repo, reset=False, diff=False):
"""Helper function to update a single repository."""
url_match = url_pattern.search(repo_entry)
if not url_match:
Expand All @@ -190,25 +192,29 @@ def repo_status(repo_entry, url_pattern, repo, reset=False):
if os.path.exists(clone_path):
try:
repo = git.Repo(clone_path)
click.echo(click.style(f"Status for {repo_name}:", fg="blue"))
click.echo(f"=== {repo_name} ===")
if reset:
click.echo(click.style(repo.git.reset("--hard"), fg="blue"))
else:
click.echo()
click.echo("Remote URLs:")
click.echo(
click.style(
"".join(
[f"{remote.name}:{remote.url}" for remote in repo.remotes]
),
fg="blue",
)
"".join(
[f"- {remote.name}:{remote.url}" for remote in repo.remotes]
),
)
click.echo()
click.echo(click.style(repo.git.status(), fg="blue"))
click.echo()
click.echo()
click.echo()
click.echo(repo.git.status())
if diff:
diff_output = repo.git.diff()
if diff_output:
click.echo(click.style(diff_output, fg="red"))
else:
click.echo(click.style("No diff output", fg="yellow"))
except git.exc.NoSuchPathError:
click.echo("Not a valid Git repository.")
else:
click.echo(f"Skipping {repo_name}: Repository not found at {clone_path}")
click.echo(
click.style(
f"Skipping {repo_name}: Repository not found at {clone_path}",
fg="yellow",
)
)
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,25 @@ packages = ["django_mongodb_cli"]
[tool.django_mongodb_cli]
dev = [
"DublinCityCenterPubFinder @ git+ssh://[email protected]/anaiyaraisin/DublinCityCenterPubFinder",
"django @ git+ssh://[email protected]/mongodb-forks/django@mongodb-5.1.x",
"django @ git+ssh://[email protected]/mongodb-forks/django@mongodb-5.2.x",
"django-allauth @ git+ssh://[email protected]/pennersr/django-allauth@main",
"django-debug-toolbar @ git+ssh://[email protected]/django-commons/django-debug-toolbar@main",
"django-filter @ git+ssh://[email protected]/carltongibson/django-filter@main",
"django-mongodb-app @ git+ssh://[email protected]/mongodb-labs/django-mongodb-app@5.1.x",
"django-mongodb-app @ git+ssh://[email protected]/mongodb-labs/django-mongodb-app@5.2.x",
"django-mongodb-backend @ git+ssh://[email protected]/mongodb/django-mongodb-backend@main",
"django-mongodb-extensions @ git+ssh://[email protected]/mongodb-labs/django-mongodb-extensions@main",
"django-mongodb-project @ git+ssh://[email protected]/mongodb-labs/django-mongodb-project@5.1.x",
"django-mongodb-project @ git+ssh://[email protected]/mongodb-labs/django-mongodb-project@5.2.x",
"django-mongodb-templates @ git+ssh://[email protected]/aclark4life/django-mongodb-templates@main",
"django-rest-framework @ git+ssh://[email protected]/encode/django-rest-framework@main",
"docs @ git+ssh://[email protected]/mongodb/docs@master",
"flask-pymongo @ git+ssh://[email protected]/mongodb-labs/flask-pymongo",
"langchain-mongodb @ git+ssh://[email protected]/langchain-ai/langchain-mongodb@main",
"libmongocrypt @ git+ssh://[email protected]/mongodb-labs/libmongocrypt@main",
"mongo-arrow @ git+ssh://[email protected]/mongodb-labs/mongo-arrow@main",
"mongo-orchestration @ git+ssh://[email protected]/mongodb-labs/mongo-orchestration@master",
"mongo-python-driver @ git+ssh://[email protected]/mongodb/mongo-python-driver@master",
"pymongo-auth-aws @ git+ssh://[email protected]/mongodb/pymongo-auth-aws@main",
"pymongo-transactions @ git+ssh://[email protected]/aclark4life/pymongo-transactions@main",
"specifications @ git+ssh://[email protected]/mongodb/specifications@master",
"wagtail @ git+ssh://[email protected]/mongodb-forks/wagtail@main",
"wagtail-mongodb-project @ git+ssh://[email protected]/mongodb-labs/wagtail-mongodb-project@main",
Expand Down