add no push option

This commit is contained in:
Derek DeJonghe 2018-06-01 14:28:30 -04:00
parent 055d0101ca
commit 67079e49e9
2 changed files with 11 additions and 5 deletions

View File

@ -1,3 +1,4 @@
import argparse
import re
import subprocess
try:
@ -6,7 +7,7 @@ except ImportError:
# Python < 3
from ConfigParser import ConfigParser
version = "1.0.5"
version = "1.0.6"
class SemVer(object):
@ -103,7 +104,7 @@ class SemVer(object):
# 2) see if we're merging into a main branch
# 3) see what type of versioning we should do
# 4) version the repo
def run(self):
def run(self,push=True):
if not self.get_branches():
raise Exception('No merge found')
if self.main_branch not in self.main_branches:
@ -112,12 +113,16 @@ class SemVer(object):
raise Exception('No git flow branch found')
self.setup_git_user()
self.version_repo()
self.commit_and_push()
if push:
self.commit_and_push()
return self
def main():
try:
SemVer().run()
parser = argparse.ArgumentParser(description='Bump Semantic Version.')
parser.add_argument('-n','--no-push', help='Do not try to push', action='store_false', dest='push')
args = parser.parse_args()
SemVer().run(push=args.push)
except Exception as e:
print(e)

View File

@ -98,7 +98,8 @@ setup(
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=[
'bumpversion==0.5.3'
'bumpversion==0.5.3',
'argparse>=1.2.1'
],
# List additional groups of dependencies here (e.g. development