summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-05-03 21:49:03 +0300
committerLars Wirzenius <liw@liw.fi>2015-05-03 21:49:03 +0300
commit4829b6eba5be26b6e5ee504a6d09638ad77aa4e4 (patch)
treeadc1d57aa1e43c9b6096e548f70dea0b001c0ca4
parent2e5b33ec19f76f2c80d8ab4dfeb499e2dd38710b (diff)
downloadjt-4829b6eba5be26b6e5ee504a6d09638ad77aa4e4.tar.gz
Refactor git stuff into global functions
-rwxr-xr-xjt21
1 files changed, 11 insertions, 10 deletions
diff --git a/jt b/jt
index cb73b6e..03580ec 100755
--- a/jt
+++ b/jt
@@ -84,6 +84,15 @@ class DraftsDirectory(object):
return None
+def commit_to_git(source_dir, pathnames):
+ cliapp.runcmd(['git', 'add'] + pathnames, cwd=source_dir)
+ cliapp.runcmd(['git', 'commit', '-m', 'Publish log entry'], cwd=source_dir)
+
+
+def push_git(source_dir):
+ cliapp.runcmd(['git', 'push', 'origin', 'HEAD'], cwd=source_dir)
+
+
class Command(object):
def __init__(self, app):
@@ -241,18 +250,10 @@ class FinishCommand(Command):
os.rename(draft_attch, pub_attch)
def _commit_to_git(self, pathnames):
- cliapp.runcmd(
- ['git', 'add'] + pathnames,
- cwd=self._app.settings['source'])
-
- cliapp.runcmd(
- ['git', 'commit', '-m', 'Publish log entry'],
- cwd=self._app.settings['source'])
+ commit_to_git(self._app.settings['source'], pathnames)
def _push_git(self):
- cliapp.runcmd(
- ['git', 'push', 'origin', 'HEAD'],
- cwd=self._app.settings['source'])
+ push_git(self._app.settings['source'])
class NewTopicCommand(Command):