summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-11-22 19:22:48 +0200
committerLars Wirzenius <liw@liw.fi>2014-11-22 19:22:48 +0200
commit7910e7d7cdeae077c7c80f7618b8afb0b2f7c046 (patch)
tree2d56c577a1ff82ca2a18dce20902749f49ea7728
parent9811a5fc00a332e29ec7671aca43682b28809609 (diff)
downloadjt-7910e7d7cdeae077c7c80f7618b8afb0b2f7c046.tar.gz
Move git stuff into helper methods
-rwxr-xr-xjt29
1 files changed, 19 insertions, 10 deletions
diff --git a/jt b/jt
index c1d292f..8e3cf02 100755
--- a/jt
+++ b/jt
@@ -175,17 +175,12 @@ class FinishCommand(Command):
os.rename(draft_attch, pub_attch)
if self._app.settings['git']:
- argv = ['git', 'add', pub_mdwn]
if os.path.exists(pub_attch):
- argv.append(pub_attch)
- cliapp.runcmd(argv, cwd=self._app.settings['source'])
- cliapp.runcmd(
- ['git', 'commit', '-m', 'Publish log entry'],
- cwd=self._app.settings['source'])
- if self.settings['push']:
- cliapp.runcmd(
- ['git', 'push', 'origin', 'HEAD'],
- cwd=self._app.settings['source'])
+ self.commit_to_git([pub_mdwn, pub_attch])
+ else:
+ self.commit_to_git([pub_mdwn])
+ if self._app.settings['push']:
+ self.push_git()
def published_dir(self):
subdirs = {
@@ -211,6 +206,20 @@ class FinishCommand(Command):
return basename
+ def commit_to_git(self, pathnames):
+ cliapp.runcmd(
+ ['git', 'add'] + pathname,
+ cwd=self._app.settings['source'])
+
+ cliapp.runcmd(
+ ['git', 'commit', '-m', 'Publish log entry'],
+ cwd=self._app.settings['source'])
+
+ def push_git(self):
+ cliapp.runcmd(
+ ['git', 'push', 'origin', 'HEAD'],
+ cwd=self._app.settings['source'])
+
class NewPersonCommand(Command):