Expand to a new release line with given ``major_number``.

        This will flesh out mandatory buckets like ``unreleased_bugfix`` and do
        other necessary bookkeeping.
495775
def add_family(self, major_number):
        
        # Normally, we have separate buckets for bugfixes vs features
        keys = ['unreleased_bugfix', 'unreleased_feature']
        # But unstable prehistorical releases roll all up into just
        # 'unreleased'
        if major_number == 0 and self.config.releases_unstable_prehistory:
            keys = ['unreleased']
        # Either way, the buckets default to an empty list
        self[major_number] = {key: [] for key in keys}
37182
def add_output(self, line):
        
        Deployment.objects.filter(pk=self.id).update(output=CF('output')+line)
547485
protected function addLimits()
    {
        if (isset($_POST[static::$versionTransformer->transform(
                    'start'
                )]) && $_POST[static::$versionTransformer->transform('length')] != '-1'
        ) {
            $this->builder->skip((int)$_POST[static::$versionTransformer->transform('start')])->take(
                (int)$_POST[static::$versionTransformer->transform('length')]
            );
        }
    }
549504
def EnsureSConsVersion(self, major, minor, revision=0):
        """"""
        # split string to avoid replacement during build process
        if SCons.__version__ == '__' + 'VERSION__':
            SCons.Warnings.warn(SCons.Warnings.DevelopmentVersionWarning,
                "EnsureSConsVersion is ignored for development version")
            return
        scons_ver = self._get_major_minor_revision(SCons.__version__)
        if scons_ver < (major, minor, revision):
            if revision:
                scons_ver_string = '%d.%d.%d' % (major, minor, revision)
            else:
                scons_ver_string = '%d.%d' % (major, minor)
            print("SCons %s or greater required, but you have SCons %s" % \
                  (scons_ver_string, SCons.__version__))
            sys.exit(2)
1211462
def expand(self, new_size):
        
        ret = self.size_total
        resp = self.modify(size=new_size)
        resp.raise_if_err()
        return ret
836911
def add_progress(kwargs, git, progress):
    """"""
    if progress is not None:
        v = git.version_info[:2]
        if v >= (1, 7):
            kwargs['progress'] = True
        # END handle --progress
    # END handle progress
    return kwargs
603855
def add_release(self, release):
        
        for r in self.releases:
            if r.version == release.version:
                return
        self.releases.append(release)
1199122
def bigger_version(version_string_a, version_string_b):
    """"""
    major_a, minor_a, patch_a = parse_version_string(version_string_a)
    major_b, minor_b, patch_b = parse_version_string(version_string_b)

    if major_a > major_b:
        return version_string_a
    elif major_a == major_b and minor_a > minor_b:
        return version_string_a
    elif major_a == major_b and minor_a == minor_b and patch_a > patch_b:
        return version_string_a
    return version_string_b
163271
def bump(dev=False, patch=False, minor=False, major=False, nocommit=False):
    """"""
    if sum([int(x) for x in (patch, minor, major)]) > 1:
        raise ValueError('Only one of patch, minor, major can be incremented.')

    if check_staged():
        raise EnvironmentError('There are staged changes, abort.')

    with open(str(INIT_PATH)) as f:
        lines = f.readlines()

    for i, line in enumerate(lines):
        varmatch = re.match("__([a-z]+)__ = '([^']+)'", line)
        if varmatch:
            if varmatch.group(1) == 'version':
                version = Version(varmatch.group(2))
                vdict = version._version._asdict()
                print('Current version:', version)
                increment_release = True
                if dev:
                    if vdict['dev']:
                        vdict['dev'] = (vdict['dev'][0], vdict['dev'][1] + 1)
                        increment_release = False
                        if sum([int(x) for x in (patch, minor, major)]) > 0:
                            raise ValueError('Cannot increment patch, minor, or major between dev versions.')
                    else:
                        vdict['dev'] = ('dev', 0)
                else:
                    if vdict['dev']:
                        vdict['dev'] = None
                        increment_release = False

                if increment_release:
                    rel = vdict['release']
                    if major:
                        vdict['release'] = (rel[0] + 1, 0, 0)
                    elif patch:
                        vdict['release'] = (rel[0], rel[1], rel[2] + 1)
                    else:  # minor is default
                        vdict['release'] = (rel[0], rel[1] + 1, 0)

                version._version = _Version(**vdict)
                print('Version bumped to:', version)
                lines[i] = "__version__ = '{!s}'\n".format(version)
                break

    with open(str(INIT_PATH), 'w') as f:
        f.writelines(lines)

    if not nocommit:
        call(['git', 'add', 'bucketcache/__init__.py'])
        call(['git', 'commit', '-m', 'Bumped version number to {!s}'.format(version)])
    return version
328327
def update_bucket_size(f):
    """"""
    @wraps(f)
    def inner(self, *args, **kwargs):
        res = f(self, *args, **kwargs)
        self.bucket.size += self.file.size
        return res
    return inner
1197411
def generate_version(max_major: int = 1, max_minor: int = 7,
                     max_patch: int = 15) -> str:
    
    major = randint(0, max_major)
    minor = randint(0, max_minor)
    patch = randint(0, max_patch)
    return '{:d}.{:d}.{:d}'.format(major, minor, patch)
1209299
def raise_on_major_version_mismatch(work_request, local_version):
    
    request_major_version = get_major_version(work_request.version)
    local_major_version = get_major_version(local_version)
    if request_major_version != local_major_version:
        raise ValueError("Received major version mismatch. request:{} local:{}".format(
            work_request.version, local_version
        ))
    else:
        logging.info("Ignoring non-major version mismatch request:{} local:{}".format(
            work_request.version, local_version))
683099
def increment_version(context):
    """"""

    attributes.replace_attribute(
        context.module_name, '__version__', context.new_version, dry_run=context.dry_run
    )
    log.info(
        'Bumped version from %s to %s' % (context.current_version, context.new_version)
    )
817461
def next_release(major=False, minor=False, patch=True):
    """"""

    import semantic_version

    prev = run('git describe --abbrev=0 --tags', warn=True, hide=True).stdout or '0.0.0'
    ver = semantic_version.Version.coerce(prev.strip())
    print('current version:', ver)
    if major:
        print('next major release:', ver.next_major())
        return ver.next_major()
    if minor:
        print('next minor release:', ver.next_minor())
        return ver.next_minor()
    if patch:
        print('next patch release:', ver.next_patch())
        return ver.next_patch()
    print('next release <undefined>')
    return None
754513
def _add_new_repo(repo, properties):
    '''
    
    '''
    repostr = '# ' if not properties.get('enabled') else ''
    repostr += 'src/gz ' if properties.get('compressed') else 'src '
    if ' ' in repo:
        repostr += '"' + repo + '" '
    else:
        repostr += repo + ' '
    repostr += properties.get('uri')
    repostr = _set_trusted_option_if_needed(repostr, properties.get('trusted'))
    repostr += '\n'
    conffile = os.path.join(OPKG_CONFDIR, repo + '.conf')

    with salt.utils.files.fopen(conffile, 'a') as fhandle:
        fhandle.write(salt.utils.stringutils.to_str(repostr))
376829
def handle_first_release_line(entries, manager):
    
    # It's remotely possible the changelog is totally empty...
    if not entries:
        return
    # Obtain (short-circuiting) first Release obj.
    first_release = None
    for obj in entries:
        if isinstance(obj, Release):
            first_release = obj
            break
    # It's also possible it's non-empty but has no releases yet.
    if first_release:
        manager.add_family(obj.family)
    # If God did not exist, man would be forced to invent him.
    else:
        manager.add_family(0)
621743
def _update_from_vcs(self, output):
        ""
        split = output[1:].split('-')
        dot_split = split[0].split('.')
        for prefix in ['a','b','rc']:
            if prefix in dot_split[-1]:
                prefix_split = dot_split[-1].split(prefix)
                self._prerelease = prefix + prefix_split[-1]
                dot_split[-1] = prefix_split[0]


        self._release = tuple(int(el) for el in dot_split)
        self._commit_count = int(split[1])

        self._commit = str(split[2][1:]) # Strip out 'g' prefix ('g'=>'git')

        self._dirty = (split[-1]=='dirty')
        return self