summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-10-14 17:17:01 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-10-14 17:17:01 +0100
commitb02f2e9e531246ac10db4938939e004a8c0374a9 (patch)
tree8dd127913a281148e119c95a10ce7f2b7d7b6579
parent803e86f545bd62045a843e1f985c0a481fb23f68 (diff)
downloadjt-b02f2e9e531246ac10db4938939e004a8c0374a9.tar.gz
Commit and push published log entries
-rwxr-xr-xjt27
1 files changed, 16 insertions, 11 deletions
diff --git a/jt b/jt
index 841f75b..cd1691d 100755
--- a/jt
+++ b/jt
@@ -58,6 +58,11 @@ class JournalTool(cliapp.Application):
'use journal layout (one of liw, ct)',
metavar='LAYOUT')
+ self.settings.boolean(
+ ['git'],
+ 'add entries to git automatically',
+ default=True)
+
def cmd_new(self, args):
'''Create a new journal entry draft.'''
@@ -196,16 +201,16 @@ class JournalTool(cliapp.Application):
if os.path.exists(draft_attch):
os.rename(draft_attch, pub_attch)
- # src = os.path.join(opts.base, 'src')
- # argv = ['bzr', 'add', finished]
- # if os.path.exists(finished_dir):
- # argv.append(finished_dir)
- # subprocess.check_call(argv, cwd=src)
- # subprocess.check_call(['bzr', 'commit', '-m', 'new note'], cwd=src)
- # subprocess.check_call(['ikiwiki', '--setup', '../ikiwiki.setup',
- # '--refresh'],
- # cwd=src)
-
-
+ if self.settings['git']:
+ argv = ['git', 'add', pub_mdwn]
+ if os.path.exists(pub_attch):
+ argv.append(pub_attch)
+ cliapp.runcmd(argv, cwd=self.settings['source'])
+ cliapp.runcmd(
+ ['git', 'commit', '-m', 'Publish log entry'],
+ cwd=self.settings['source'])
+ cliapp.runcmd(
+ ['git', 'push', 'origin', 'HEAD'],
+ cwd=self.settings['source'])
JournalTool().run()