X-Git-Url: https://projects.mako.cc/source/iron-blogger/blobdiff_plain/d9449b6b588a35f54b61698de5f82ebde11af118..d9320096f79979eade4c0ec93beae156ec975ffb:/weekly-update.py diff --git a/weekly-update.py b/weekly-update.py index 4aa749c..284ffb6 100755 --- a/weekly-update.py +++ b/weekly-update.py @@ -7,8 +7,8 @@ import subprocess import datetime import yaml -XMLRPC_ENDPOINT = 'http://iron-blogger.mit.edu/xmlrpc.php' -USER = 'nelhage' +XMLRPC_ENDPOINT = 'http://iron-blogger.mako.cc/xmlrpc.php' +USER = 'mako' BLOG_ID = 1 dry_run = False @@ -25,8 +25,9 @@ with open('ledger', 'a') as f: f.write("\n") f.write(render.render_template('templates/ledger', date)) -subprocess.check_call(["git", "commit", "ledger", - "-m", "Update for %s" % (date,)]) +if not dry_run: + subprocess.check_call(["git", "commit", "ledger", + "-m", "Update for %s" % (date,)]) debts = render.get_debts() punt = [] @@ -80,5 +81,13 @@ if punt: with open('bloggers.yml','w') as b: yaml.safe_dump(bloggers, b) - subprocess.check_call(["git", "commit", "ledger", "bloggers.yml", - "-m", "Punts for %s" % (today,)]) + if not dry_run: + subprocess.check_call(["git", "commit", "ledger", "bloggers.yml", + "-m", "Punts for %s" % (today,)]) + +# if it's a dry run, lets set the ledger back to the beginning state +if dry_run: + subprocess.check_call(["git", "checkout", "ledger"]) + + if punt: + subprocess.check_call(["git", "checkout", "bloggers.yml"])