Create a new Version that discards the entity information of build and
originalVersionString

@return Version
333612
public function cleanCopy()
    {
        $version = new Version;

        $version->setMajor($this->getMajor());
        $version->setMinor($this->getMinor());
        $version->setPatch($this->getPatch());

        if ($this->hasPreRelease()) {
            $version->preRelease = clone($this->getPreRelease());
        }

        return $version;
    }
1065250
public VersionInfo merge() {
    if (isReference()) {
      final VersionInfo refVersion = (VersionInfo) getCheckedRef(VersionInfo.class, "VersionInfo");
      return refVersion.merge();
    }
    Reference currentRef = this.getExtends();
    if (currentRef == null) {
      return this;
    }
    final Vector<VersionInfo> stack = new Vector<>(5);
    stack.addElement(this);
    while (currentRef != null) {
      final Object obj = currentRef.getReferencedObject(getProject());
      if (obj instanceof VersionInfo) {
        VersionInfo current = (VersionInfo) obj;
        if (current.isReference()) {
          current = (VersionInfo) current.getCheckedRef(VersionInfo.class, "VersionInfo");
        }
        if (stack.contains(current)) {
          throw this.circularReference();
        }
        stack.addElement(current);
        currentRef = current.getExtends();
      } else {
        throw new BuildException("Referenced element " + currentRef.getRefId() + " is not a versioninfo.");
      }
    }
    return new VersionInfo(stack);
  }
1038963
private function getVersion(): ?Version
    {
        // Oops, unknown/empty path of a file who contains version
        if (empty($this->versionFilePath)) {
            throw EmptyVersionFilePathException::create();
        }

        // Oops, not readable/accessible file who contains version
        if (!is_readable($this->versionFilePath)) {
            throw UnreadableVersionFileException::create($this->versionFilePath);
        }

        $contents = file_get_contents($this->versionFilePath);

        return Version::fromString($contents);
    }
1018227
public VersionInfo toInfo() {
        return new VersionInfo(
                parseDate(date),
                display,
                full,
                branch,
                build,
                commit,
                source,
                sourceType
        );
    }
1014757
static function databaseVersion( $withRelease = true )
    {
        $db = eZDB::instance();
        $rows = $db->arrayQuery( "SELECT value as version FROM ezsite_data WHERE name='ezpublish-version'" );
        $version = false;
        if ( count( $rows ) > 0 )
        {
            $version = $rows[0]['version'];
            if ( $withRelease )
            {
                $release = eZPublishSDK::databaseRelease();
                $version .= '-' . $release;
            }
        }
        return $version;
    }
61362
private Version parseValidSemVer() {
    NormalVersion normal = parseVersionCore();
    MetadataVersion preRelease = MetadataVersion.NULL;
    MetadataVersion build = MetadataVersion.NULL;

    Character next = consumeNextCharacter(CharType.HYPHEN, CharType.PLUS, CharType.EOL);
    if (CharType.HYPHEN.isMatchedBy(next)) {
      preRelease = parsePreRelease();
      next = consumeNextCharacter(CharType.PLUS, CharType.EOL);
      if (CharType.PLUS.isMatchedBy(next)) {
        build = parseBuild();
      }
    } else if (CharType.PLUS.isMatchedBy(next)) {
      build = parseBuild();
    }
    consumeNextCharacter(CharType.EOL);
    return new Version(normal, preRelease, build);
  }
1141454
public function createNewVersionNode(NodeInterface $originalNode, $versionName = '')
    {
        $status = $this->statusRepository->findOneByInitial();

        /** @var NodeInterface $newNode */
        $newNode = clone $originalNode;
        $newNode->setStatus($status);
        $newNode->setVersion($this->uniqueIdGenerator->generateUniqueId());
        $this->duplicateArea($originalNode, $newNode);

        $newNode->setVersionName($versionName);
        if (empty($versionName)) {
            $newNode = $this->setVersionName($newNode);
        }


        return $newNode;
    }
988453
String getBuildVersion() {
        if (this.buildVersion == null) {
            Properties prop = new Properties();
            try {
                // try system
                URL u = ClassLoader.getSystemResource(SQLG_APPLICATION_PROPERTIES);
                if (u == null) {
                    // try own class loader
                    u = getClass().getClassLoader().getResource(SQLG_APPLICATION_PROPERTIES);
                }
                if (u != null) {
                    try (InputStream is = u.openStream()) {
                        prop.load(is);
                    }
                    this.buildVersion = prop.getProperty(APPLICATION_VERSION);
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return this.buildVersion;
    }
1239777
private function absorbVersion()
    {
        if (($type = $this->config->get('current.git_absorb')) === false) {
            return;
        }

        $version = $this->git->extractVersion(
            $this->git->getVersionFromGit($type)
        );

        $config = $this->config->getRoot();

        $config['current']['major'] = (int) $version[1][0];

        $config['current']['minor'] = (int) $version[2][0];

        $config['current']['patch'] = (int) $version[3][0];

        $this->config->update($config);
    }
203172
public com.google.appengine.v1.CreateVersionMethodOrBuilder getCreateVersionOrBuilder() {
    if (methodCase_ == 2) {
       return (com.google.appengine.v1.CreateVersionMethod) method_;
    }
    return com.google.appengine.v1.CreateVersionMethod.getDefaultInstance();
  }
628302
protected function getVersion()
	{
		if (is_null($this->version))
		{
			// get the first version in versions
			$this->version = reset($this->versions);
		}

		return $this->version;
	}
1038647
function Version()
	{
		$ver = (is_null($this) ? XDB_VERSION : $this->version);
		$str = sprintf("%s/%d.%d", XDB_TAGNAME, ($ver >> 5), ($ver & 0x1f));
		if (!is_null($this)) $str .= " <base={$this->hash_base}, prime={$this->hash_prime}>";
		return $str;
	}
1115014
protected String getCurrentReleaseVersion() {
        HttpURLConnection conn = null;
        try {
            final String str = settings.getString(Settings.KEYS.ENGINE_VERSION_CHECK_URL, "http://jeremylong.github.io/DependencyCheck/current.txt");
            final URL url = new URL(str);
            final URLConnectionFactory factory = new URLConnectionFactory(settings);
            conn = factory.createHttpURLConnection(url);
            conn.connect();
            if (conn.getResponseCode() != 200) {
                return null;
            }
            final String releaseVersion = IOUtils.toString(conn.getInputStream(), StandardCharsets.UTF_8);
            if (releaseVersion != null) {
                return releaseVersion.trim();
            }
        } catch (MalformedURLException ex) {
            LOGGER.debug("Unable to retrieve current release version of dependency-check - malformed url?");
        } catch (URLConnectionFailureException ex) {
            LOGGER.debug("Unable to retrieve current release version of dependency-check - connection failed");
        } catch (IOException ex) {
            LOGGER.debug("Unable to retrieve current release version of dependency-check - i/o exception");
        } finally {
            if (conn != null) {
                conn.disconnect();
            }
        }
        return null;
    }
1002494
public function getVersions()
    {
        while (
            !empty($this->version) &&
            substr_count($this->version, '.') < 2
        ) {
            $this->version .= '.0';
        }
        // Remove part by part of the version.
        $result = array_merge(
            [$this->version],
            $this->explode($this->version, '.')
        );
        asort($result);
        usort($result, function ($a, $b) {
            // PHP 7: Switch to the <=> "Spaceship" operator
            return strlen($b) - strlen($a);
        });
        return $this->filterDuplicates($result);
    }
512086
function cloneVersion( $newVersionNumber, $userID, $contentObjectID = false, $status = eZContentObjectVersion::STATUS_DRAFT )
    {
        $time = time();
        $clonedVersion = clone $this;
        $clonedVersion->setAttribute( 'id', null );
        if ( $contentObjectID !== false )
            $clonedVersion->setAttribute( 'contentobject_id', $contentObjectID );
        $clonedVersion->setAttribute( 'version', $newVersionNumber );
        $clonedVersion->setAttribute( 'created', $time );
        $clonedVersion->setAttribute( 'modified', $time );
        $clonedVersion->setAttribute( 'creator_id', $userID );
        if ( $status !== false )
            $clonedVersion->setAttribute( 'status', $status );
        return $clonedVersion;
    }
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
563814
public function getCurrentVersion()
    {
        // We don't cache this code as the current version is pretty volatile.
        // TODO - that means they're no point in a setter then?
        // maybe we should cache and call a reset() method every time a migration is run
        $versions = $this->getVersions();
        $version = 0;

        if (!empty($versions)) {
            $version = end($versions);
        }

        $this->setCurrentVersion($version);

        return $this->currentVersion;
    }