Skip to content
Open
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
2 changes: 1 addition & 1 deletion odev/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
# or merged change.
# ------------------------------------------------------------------------------

__version__ = "4.29.5"
__version__ = "4.29.6"

Check notice on line 25 in odev/_version.py

View workflow job for this annotation

GitHub Actions / version-bump

Patch Update
45 changes: 45 additions & 0 deletions odev/upgrades/4.29.6/upgrade.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""Upgrade to odev 4.29.4.

Reset the 'beta' branch of all installed plugins to their remote state.

The 'beta' branch of several plugin repositories was force-pushed. Users on the
'beta' release channel have those plugins checked out on a local 'beta' branch
whose history diverged from the rewritten remote, which would make odev's next
pull fail. This hard-resets each beta-checked-out plugin to 'origin/beta'.
"""

from git import GitCommandError

from odev.common import progress
from odev.common.connectors.git import GitConnector
from odev.common.logging import logging
from odev.common.odev import Odev


logger = logging.getLogger(__name__)

BETA_BRANCH = "beta"


def run(odev: Odev) -> None:
for plugin in odev.plugins:
git = GitConnector(plugin.name)
repository = git.repository

if repository is None:
logger.debug(f"Plugin {plugin.name!r} is not a git repository, skipping")
continue

if git.branch != BETA_BRANCH:
logger.debug(f"Plugin {plugin.name!r} is not on the {BETA_BRANCH!r} branch, skipping")
continue

try:
with progress.spinner(f"Resetting {BETA_BRANCH!r} branch of plugin {plugin.name!r} to its remote state"):
repository.git.fetch("origin", BETA_BRANCH)
repository.git.reset("--hard", f"origin/{BETA_BRANCH}")
except GitCommandError as error:
logger.warning(f"Failed to reset {BETA_BRANCH!r} branch of plugin {plugin.name!r}: {error}")
continue

logger.info(f"Reset {BETA_BRANCH!r} branch of plugin {plugin.name!r} to its remote state")
Loading