From 0de0c28ea8e60b97ad567c37a35d6781024686d3 Mon Sep 17 00:00:00 2001 From: Aniket Pant Date: Sun, 14 Apr 2013 03:27:58 +0530 Subject: [PATCH] Git integration complete Ready to be made better Fixes maebert/jrnl#35 Signed-off-by: Aniket Pant --- jrnl/Journal.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jrnl/Journal.py b/jrnl/Journal.py index 8d595eff..cd195dbe 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -3,6 +3,7 @@ from Entry import Entry import exporters +import subprocess import os import parsedatetime.parsedatetime as pdt import re @@ -284,6 +285,12 @@ class Journal(object): exporters.to_txt(self, self.config['sync_folder'] + "journal.txt") elif arg == "files": exporters.to_files(self, self.config['sync_folder'] + "*.txt") + os.chdir(self.config['sync_folder']) + subprocess.call(["git", "pull"]) + subprocess.call(["git", "add", "."]) + message = "Site update at " + str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + subprocess.call(["git", "commit", "-m", message]) + subprocess.call(["git", "push"]) return "journal synced to " + self.config['sync_folder']