Preserve higher weight for CLI git ref versions

Currently the concretizer fails if you reuse a git ref version
that has already been installed but modify the spec at all.

See #38484 for futher diagnosis

The issue here is that since there is no established provenance for
these versions the highest weight they are currently assigned is
that of prior install. Re-use checks then fail because the weight of
the version is identical to the solver.

Ironically, these versions are given the highest weights possible when
specified on the CLI for the first time.  They should only appear in a
DAG if they are an exact match or if the user specifies them at the CLI.
Therefore it makes sense to preserve their higher ordering.

Getting this right is critical to moving all branch based versions to a pinned
git-ref in the future.
This commit is contained in:
psakiev 2024-04-25 22:16:25 -06:00
parent 4a40a76291
commit 65d32db087

View File

@ -2000,7 +2000,7 @@ def define_ad_hoc_versions_from_specs(
# best possible, so they're guaranteed to be used preferentially.
version = s.versions.concrete
if version is None or any(v == version for v in self.possible_versions[s.name]):
if version is None or any((v == version and not isinstance(version, vn.GitVersion)) for v in self.possible_versions[s.name]):
continue
if require_checksum and not _is_checksummed_git_version(version):