Change old version to the new one in every file given.

    Note that this version is not the tag formatted one.
    So for example, your tag could look like `v1.0.0` while your version in
    the package like `1.0.0`.
199197
def update_version_in_files(current_version: str, new_version: str, files: list):
    
    for filepath in files:
        # Read in the file
        with open(filepath, "r") as file:
            filedata = file.read()

        # Replace the target string
        filedata = filedata.replace(current_version, new_version)

        # Write the file out again
        with open(filepath, "w") as file:
            file.write(filedata)
46448
def get_version_from_tag(tag_name: str) -> Optional[str]:
    

    debug('get_version_from_tag({})'.format(tag_name))
    check_repo()
    for i in repo.tags:
        if i.name == tag_name:
            return i.commit.hexsha
    return None
221543
def versionfile(dir = Dir.pwd, options = {})
      file    = (options[:file])    ? options[:file]    : 'VERSION'
      version = (options[:version]) ? options[:version] : '0.0.0'
      info " ==> bootstrapping a VERSION file"
      path = normalized_path(dir)
      path = FalkorLib::Git.rootdir(path) if FalkorLib::Git.init?(path)
      unless Dir.exist?( path )
        warning "The directory #{path} does not exists and will be created"
        really_continue?
        FileUtils.mkdir_p path
      end
      versionfile = File.join(path, file)
      if File.exist?( versionfile )
        puts "  ... not overwriting the #{file} file which already exists"
      else
        FalkorLib::Versioning.set_version(version, path, :type => 'file',
                                          :source => { :filename => file })
        Dir.chdir( path ) do
          run %( git tag #{options[:tag]} ) if options[:tag]
        end
      end

      # unless File.exists?( versionfile )
      #     run %{  echo "#{version}" > #{versionfile} }
      #     if FalkorLib::Git.init?(path)
      #         FalkorLib::Git.add(versionfile, "Initialize #{file} file")
      #         Dir.chdir( path ) do
      #             run %{ git tag #{options[:tag]} } if options[:tag]
      #         end
      #     end
      # else
      #     puts "  ... not overwriting the #{file} file which already exists"
      # end
    end
1365156
function processTags (content, version, versions, file) {
  const tags = quantum.select(content)
    .selectAll(['added', 'updated', 'deprecated', 'removed', 'bugfix'], {recursive: true})
    .filter(tag => {
      const tagHasKnownVersion = versions.indexOf(tag.ps()) > -1

      if (!tagHasKnownVersion) {
        file.warning({
          module: 'quantum-version',
          problem: `Unexpected version "${tag.ps()}" found in @${tag.type()}`,
          resolution: `Correct the versions list, or the tag version. The versions list for this page is [${versions.join(', ')}]`
        })
        tag.remove()
      }

      return tagHasKnownVersion
    })

  tags.filter(t => t.type() === 'added').forEach(addedTag => {
    // If the content has not yet been added, remove it
    if (versionABeforeVersionB(version, addedTag.ps(), versions)) {
      addedTag.parent().remove()
    } else if (addedTag.ps() !== version) {
      // If the content was added in a previous version, remove the added tag
      addedTag.remove()
    }
  })

  tags.filter(t => t.type() === 'updated').forEach(updatedTag => {
    if (updatedTag.ps() !== version) {
      updatedTag.remove()
    }
  })

  tags.filter(t => t.type() === 'bugfix').forEach(bugfixTag => {
    if (bugfixTag.ps() !== version) {
      bugfixTag.remove()
    }
  })

  tags.filter(t => t.type() === 'deprecated').forEach(deprecatedTag => {
    if (versionABeforeVersionB(version, deprecatedTag.ps(), versions)) {
      deprecatedTag.remove()
    }
  })

  tags.filter(t => t.type() === 'removed').forEach(removedTag => {
    // if the content was removed in a previous version, remove it
    if (versionABeforeVersionB(removedTag.ps(), version, versions)) {
      removedTag.parent().remove()
    } else if (removedTag.ps() === version) {
      // If it was removed in this version, remove any deprecated tag
      removedTag.parent().removeChildOfType('deprecated')
    } else {
      // Otherwise, the content has not been removed yet, so just remove the
      // 'removed' tag. It is not yet its time.
      removedTag.remove()
    }
  })
}
1108904
def at_version!(version)
      return self if log_data.version == version
      return false unless log_data.find_by_version(version)

      apply_diff(version, log_data.changes_to(version: version))
    end
1322390
def norm_package_version(version):
    """"""
    if version:
        version = ','.join(v.strip() for v in version.split(',')).strip()

        if version.startswith('(') and version.endswith(')'):
            version = version[1:-1]

        version = ''.join(v for v in version if v.strip())
    else:
        version = ''

    return version
1164748
def check_tag(version):
    

    output = run('git', 'tag', stdout=subprocess.PIPE).communicate()[0]
    tags = set(output.decode('utf-8').splitlines())

    if 'v{}'.format(version) in tags:
        error('version already exists')
1295977
def update_version_module(check_name, old_ver, new_ver):
    
    version_file = get_version_file(check_name)
    contents = read_file(version_file)

    contents = contents.replace(old_ver, new_ver)
    write_file(version_file, contents)
39403
def it_self_update():
    
    __new_version__ = ""
    repository = "gitlab"
    branch = "master"
    ver_link = ("https://raw.{0}usercontent.com/{1}/{2}/"
                "{3}/{4}/__metadata__.py".format(repository, _meta_.__author__,
                                                 _meta_.__all__, branch,
                                                 _meta_.__all__))
    version_data = URL(ver_link).reading()
    for line in version_data.splitlines():
        line = line.strip()
        if line.startswith("__version_info__"):
            __new_version__ = ".".join(re.findall(r"\d+", line))
    if __new_version__ > _meta_.__version__:
        if _meta_.default_answer in ["y", "Y"]:
            answer = _meta_.default_answer
        else:
            print("\nNew version '{0}-{1}' is available !\n".format(
                _meta_.__all__, __new_version__))
            try:
                answer = raw_input("Would you like to upgrade [y/N]? ")
            except EOFError:
                print("")
                raise SystemExit()
        if answer in ["y", "Y"]:
            print("")   # new line after answer
        else:
            raise SystemExit()
        dwn_link = ["https://{0}.com/{1}/{2}/archive/"
                    "v{3}/{4}-{5}.tar.gz".format(repository, _meta_.__author__,
                                                 _meta_.__all__,
                                                 __new_version__,
                                                 _meta_.__all__,
                                                 __new_version__)]
        if not os.path.exists(_meta_.build_path):
            os.makedirs(_meta_.build_path)
        Download(_meta_.build_path, dwn_link, repo="").start()
        os.chdir(_meta_.build_path)
        slpkg_tar_file = "slpkg" + "-" + __new_version__ + ".tar.gz"
        tar = tarfile.open(slpkg_tar_file)
        tar.extractall()
        tar.close()
        file_name = "{0}-{1}".format(_meta_.__all__, __new_version__)
        os.chdir(file_name)
        check_md5(pkg_checksum(slpkg_tar_file, _meta_.__all__),
                  _meta_.build_path + slpkg_tar_file)
        subprocess.call("chmod +x {0}".format("install.sh"), shell=True)
        subprocess.call("sh install.sh", shell=True)
    else:
        print("\n{0}: There is no new version, already used the last !"
              "\n".format(_meta_.__all__))
    raise SystemExit()
292102
def add_changed_pkg_xml(obj)
      versions_elem = obj.add_element 'versions'
      @changed_pkgs.each do |vers|
        velem = versions_elem.add_element 'version'
        velem.add_element('software_version').text = vers.to_s
        pkg = velem.add_element 'package'
        # leave am empty package element to remove the pkg assignement
        next if versions[vers].package_id == :none
        pkg.add_element('id').text = versions[vers].package_id.to_s
      end # do vers
    end
22777
function bumpTask(complete) {
  util.log('Current version:', util.colors.cyan(pkg.version));
  var choices = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'].map(function(versionType) {
    return versionType + ' (v' + semver.inc(pkg.version, versionType) + ')';
  });
  inquirer.prompt({
    type: 'list',
    name: 'version',
    message: 'What version update would you like?',
    choices: choices
  }).then(function(res) {
    var increment = res.version.split(' ')[0],
      newVersion = semver.inc(pkg.version, increment);

    // Set the new versions into the package object
    pkg.version = newVersion;

    // Write these to their own files, then build the output
    fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));

    complete();
  });
}
1256979
function replaceVersionPlaceholders(packageDir, projectVersion) {
  // Resolve files that contain version placeholders using Grep or Findstr since those are
  // extremely fast and also have a very simple usage.
  const files = findFilesWithPlaceholders(packageDir);

  // Walk through every file that contains version placeholders and replace those with the current
  // version of the root package.json file.
  files.forEach(filePath => {
    const fileContent = readFileSync(filePath, 'utf-8')
      .replace(ngVersionPlaceholderRegex, buildConfig.angularVersion)
      .replace(materialVersionPlaceholderRegex, buildConfig.materialVersion)
      .replace(versionPlaceholderRegex, projectVersion);

    writeFileSync(filePath, fileContent);
  });
}
986451
def set_version(new_version_number=None, old_version_number=''):
    
    if new_version_number is None:
        return ValueError

    import fileinput
    import sys

    file = join('timezonefinder', '__init__.py')

    for line in fileinput.input(file, inplace=1):
        if old_version_number in line:
            line = line.replace(old_version_number, new_version_number)
        sys.stdout.write(line)
167913
def update_product_version(id, **kwargs):
    
    content = update_product_version_raw(id, **kwargs)
    if content:
        return utils.format_json(content)
1686
def add_version(f):
    
    doc = f.__doc__
    f.__doc__ = "Version: " + __version__ + "\n\n" + doc
    return f
666569
def update_version_number(update_level='patch'):
    """Find current version"""
    temp_file = version_file().parent / ("~" + version_file().name)
    with open(str(temp_file), 'w') as g:
        with open(str(version_file()), 'r') as f:
            for line in f:
                version_matches = bare_version_re.match(line)
                if version_matches:
                    bare_version_str = version_matches.groups(0)[0]
                    if semantic_version.validate(bare_version_str):
                        current_version = Version(bare_version_str)
                        print("{}Current version is {}".format(" "*4, current_version))
                    else:
                        current_version = Version.coerce(bare_version_str)
                        if not text.query_yes_quit("{}I think the version is {}. Use it?".format(" "*4, current_version), default="yes"):
                            exit(Fore.RED + 'Please set an initial version number to continue')

                    """Determine new version number"""
                    if update_level is 'major':
                        current_version = current_version.next_major()
                    elif update_level is 'minor':
                        current_version = current_version.next_minor()
                    elif update_level is 'patch':
                        current_version = current_version.next_patch()
                    elif update_level is 'prerelease':
                        if not current_version.prerelease:
                            current_version = current_version.next_patch()
                            current_version.prerelease = ('dev', )
                    else:
                        exit(Fore.RED + 'Cannot update version in {} mode'.format(update_level))

                    print("{}New version is     {}".format(" "*4, current_version))

                    """Update version number"""
                    line = '__version__ = "{}"'.format(current_version)
                print(line, file=g, end="")
        print('', file=g)  # add a blank line at the end of the file
    shutil.copyfile(str(temp_file), str(version_file()))
    os.remove(str(temp_file))
    return(current_version)
610041
def update_version
      return create_version unless v = versions.last
      v.modifications_will_change!
      v.update_attribute(:modifications, v.changes.append_changes(version_changes))
      reset_version_changes
      reset_version
    end