def patch(level=None): """ Release a patch for this package. Increase the last part of the version number by 1 or by ``level`` if specified. :param level: set the patch 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.patch = int(level) else: new_version.patch += 1 # Reset others new_version.build = None # Call new to init the full process execute(new, str(new_version))
def check_version_compatibility(self, remote): """For local a1.b1.c1 and remote a2.b2.c2, check if "a1.b1" == "a2.b2" and c1 >= c2 :param remote: remote version string :return: whether the local version is compatible with remote version """ remote = Version(remote) local = Version(self.app_version, partial=True) local_patch = local.patch local.patch = None return local == remote and local_patch >= remote.patch
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 __init__(self, name, object_number): assert type(name) == self._name_class, "Wrong type: {}. Expected {}"\ .format(type(name), self._name_class) self._on = object_number self._name = name if not self._name.type_is_compatible(self._on): raise TypeError("The name and the object number must be "+ "of compatible types: got {} and {}" .format(type(name), type(object_number))) # Update the patch number to always be the revision nv = Version(self._name.version) nv.patch = int(self._on.revision) self._name.version = str(nv) self.locations = Locations(self) self.data = {} self.is_valid()
def version_patch(self, value): v = Version(self.version) v.patch = int(value) self.version = str(v)
def inc_patch(version): v = Version(str(version)) v.patch = v.patch + 1 return v
def inc_minor(version): v = Version(str(version)) v.minor = v.minor + 1 v.patch = 0 return v