Skip to content

Commit 26a3da6

Browse files
committed
[IMP] Do not update plugins if not on the default branch
Avoid losing progress unexpectedly when running odev while developing a plugin.
1 parent 29f4d7c commit 26a3da6

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

odev/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
# or merged change.
2323
# ------------------------------------------------------------------------------
2424

25-
__version__ = "4.20.0"
25+
__version__ = "4.20.1"

odev/common/odev.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,16 @@ def _update(self, path: Path, plugin: str | None = None) -> bool:
303303
)
304304

305305
current_branch = git.repository.active_branch.name
306+
default_branch = git.default_branch
306307

307-
if not plugin and current_branch != "main":
308-
logger.warning("Running from a non-standard branch, update may not be available")
309-
logger.info("Consider switching to the 'main' branch for regular updates")
308+
if current_branch != default_branch:
309+
target = "Odev" if not plugin else f"Plugin {plugin!r}"
310+
logger.warning(
311+
f"{target} is running from a non-standard branch {current_branch!r}, assuming your are in "
312+
"development mode\nUpdates will not be pulled automatically\nConsider switching to branch "
313+
f"{default_branch!r} for regular updates"
314+
)
315+
return False
310316

311317
logger.debug(f"Pulling latest changes from {git.name!r} on branch {current_branch!r}")
312318
install_requirements = self.__requirements_changed(git.repository)

0 commit comments

Comments
 (0)