Skip to content
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

adds a git pull on page featch #128

Merged
merged 2 commits into from
Jan 28, 2024
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
10 changes: 10 additions & 0 deletions git_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,13 @@ def git_sync(self, page_name: str = "", commit_type: str = ""):

if self.sync_with_remote:
self.__git_push()

def git_pull(self):
"""
Function that manages the synchronization with a git repo, that could be local or remote.
If SYNC_WITH_REMOTE is set, it also pulls before committing and then pushes changes to the remote repo.
:param commit_type: could be 'Add', 'Edit' or 'Remove'.
:param page_name: name of the page that has been changed.
"""
if self.sync_with_remote:
self.__git_pull()
5 changes: 5 additions & 0 deletions wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ def file_page(file_page):
if request.args.get("q"):
return search(request.args.get("q"), request.args.get("page", 1))
else:

git_sync_thread = Thread(target=wrm.git_pull, args=())
git_sync_thread.start()

html = ""
mod = ""
folder = ""
Expand All @@ -244,6 +248,7 @@ def index():
if request.args.get("q"):
return search(request.args.get("q"), request.args.get("page", 1))
else:

html = ""
app.logger.info("Showing HTML page >>> 'homepage'")

Expand Down
Loading