Skip to content

Instantly share code, notes, and snippets.

@LordAro
Created December 11, 2014 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LordAro/6cec7e2af22b5ae6a019 to your computer and use it in GitHub Desktop.
Save LordAro/6cec7e2af22b5ae6a019 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from bottle import route, run, post, request
from subprocess import call
import _thread as thread
@route("/~lordaro/hook")
def hook():
with open("test.txt", "r") as myfile:
return myfile.read()
return "Ah! Could not read file!"
@post("/~lordaro/hook")
def hook_post():
def do_git():
call(["git", "svn", "rebase"], cwd="freerct.git")
call(["git", "push", "-f", "--mirror"], cwd="freerct.git")
thread.start_new_thread(do_git, ())
with open("test.txt", "a") as myfile:
myfile.write(request.body.read().decode("utf-8"))
myfile.write("\n")
return "Gotcha!"
run(host="localhost", port=8080, debug=True, reloader=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment