def minor(level=None): """ Release a minor version for this package. Increase the middle part of the version number by 1 or by ``level`` if specified. :param level: set the minor level to this number. :type level: int """ # Stop if project has no tags if not git.has_tag(): abort('You should use package.release.new() task as it seems there is' ' no version yet !') # Get the last released version from changelog last_released_version = helpers.get_last_version() puts(cyan('Last released version is %s.' % last_released_version)) # Make a new version new_version = Version(str(last_released_version)) if level: new_version.minor = int(level) else: new_version.minor += 1 # Reset others new_version.patch = 0 new_version.build = None # Call new to init the full process execute(new, str(new_version))
def flowStart(action, increment): version = Version(VersionString) if increment == 'patch': version.patch += 1 elif increment == 'minor': version.minor += 1 version.patch = 0 elif increment == 'major': version.major += 1 version.minor = 0 version.patch = 0 else: raise Exception('unexpected increment target') newVersionString = "%d.%d.%d" % (version.major, version.minor, version.patch) print "running - git flow %s start %d.%d.%d" % (action, version.major, version.minor, version.patch) if subprocess.call(['git', 'flow', action, 'start', "%d.%d.%d" % (version.major, version.minor, version.patch)]) != 0: sys.exit() newContents = TargetContents[:VersionMatch.start(1)] + newVersionString + TargetContents[VersionMatch.end(1):] with open(TargetPath, 'w+') as fTarget: fTarget.write(newContents) subprocess.call(['git', 'add', TargetPath])
def version_minor(self, value): v = Version(self.version) v.minor = int(value) self.version = str(v)
def inc_minor(version): v = Version(str(version)) v.minor = v.minor + 1 v.patch = 0 return v