From 4021e69f4d08f04b6712203cf2e189884b9c0ed6 Mon Sep 17 00:00:00 2001 From: "M. Taylor Saotome-Westlake" Date: Fri, 15 Dec 2017 09:09:45 -0800 Subject: [PATCH] autoscheduler: hard-reset instead of pull; another sitegen on push Not tested yet, but it's quite hard to see what bugs could be lurking in this fourish-line diff. --- notes/tech_tasks.txt | 1 - provisioning/pelican_scheduler.py | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/notes/tech_tasks.txt b/notes/tech_tasks.txt index d142ff4..b59657e 100644 --- a/notes/tech_tasks.txt +++ b/notes/tech_tasks.txt @@ -10,5 +10,4 @@ sheet music width other image width more Korra cosplay photos?? even more fine-grained tag size?? (I tried this once and made it look worse :/) -make the autoscheduler compatible with force-pushing (`reset --hard` instead of `pull`) Atom vs. RSS proper?? diff --git a/provisioning/pelican_scheduler.py b/provisioning/pelican_scheduler.py index 8701227..c58a036 100755 --- a/provisioning/pelican_scheduler.py +++ b/provisioning/pelican_scheduler.py @@ -67,7 +67,14 @@ def main(): # repo confuse us our_env = os.environ.copy() del our_env['GIT_DIR'] - subprocess.run(["git", "pull"], cwd=WORKING_REPO, env=our_env) + + for git_cmd in [["git", "fetch", "origin"], + ["git", "reset", "--hard", "origin/master"]]: + subprocess.run(git_cmd, cwd=WORKING_REPO, env=our_env) + + # sitegen now! (even if there are no posts to queue, we can at least update + # /drafts/) and make any back-edits to published posts live + subprocess.run(SITEGEN_COMMAND) # look for scheduled future posts future_publication_times = get_future_publication_times() -- 2.17.1