diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-05-03 21:49:03 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-05-03 21:49:03 +0300 |
commit | 4829b6eba5be26b6e5ee504a6d09638ad77aa4e4 (patch) | |
tree | adc1d57aa1e43c9b6096e548f70dea0b001c0ca4 /jt | |
parent | 2e5b33ec19f76f2c80d8ab4dfeb499e2dd38710b (diff) | |
download | jt-4829b6eba5be26b6e5ee504a6d09638ad77aa4e4.tar.gz |
Refactor git stuff into global functions
Diffstat (limited to 'jt')
-rwxr-xr-x | jt | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -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): |