QChatGPT/pkg/utils/updater.py

13 lines
490 B
Python
Raw Normal View History

2023-01-02 12:54:38 +08:00
import dulwich.porcelain
2023-01-01 22:52:27 +08:00
def update_all():
try:
from dulwich import porcelain
repo = porcelain.open_repo('.')
porcelain.pull(repo)
except ModuleNotFoundError:
2023-01-02 12:54:38 +08:00
raise Exception("dulwich模块未安装,请查看 https://github.com/RockChinQ/QChatGPT/issues/77")
except dulwich.porcelain.DivergedBranches:
raise Exception("分支不一致,自动更新仅支持master分支,请手动更新(https://github.com/RockChinQ/QChatGPT/issues/76)")