Skip to content
Merged
Changes from 1 commit
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
12 changes: 11 additions & 1 deletion odev/common/commands/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
from odev.common import args
from odev.common.commands import Command
from odev.common.connectors import GitConnector, GitWorktree
from odev.common.logging import logging
from odev.common.odoobin import odoo_repositories


logger = logging.getLogger(__name__)


class GitCommand(Command, ABC):
"""Base command class for interacting with git repositories and worktrees."""

Expand All @@ -21,7 +25,13 @@ def repositories(self) -> Generator[GitConnector, None, None]:
def worktrees(self) -> Generator[GitWorktree, None, None]:
"""Iterate over worktrees in Odoo repositories."""
for repository in self.repositories:
yield from repository.worktrees()
for worktree in repository.worktrees():
if not worktree.path.exists():
logger.debug(f"Skipping missing worktree {worktree.name!r} at {worktree.path!s}")
continue
if hasattr(self, "args") and self.args.version and worktree.name != self.args.version:
continue
yield worktree

@property
def grouped_worktrees(self) -> dict[str, list[GitWorktree]]:
Expand Down
Loading