Use ParsedGitUrl to recreate Git source kind URL (#3647)

This commit is contained in:
Charlie Marsh 2024-05-17 17:45:46 -04:00 committed by GitHub
parent e2d7d2026b
commit fe2bc079bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View file

@ -12,8 +12,9 @@ use url::Url;
use distribution_filename::WheelFilename; use distribution_filename::WheelFilename;
use distribution_types::{ use distribution_types::{
BuiltDist, DirectUrlBuiltDist, DirectUrlSourceDist, DirectorySourceDist, Dist, FileLocation, BuiltDist, DirectUrlBuiltDist, DirectUrlSourceDist, DirectorySourceDist, Dist, FileLocation,
GitSourceDist, IndexUrl, ParsedArchiveUrl, PathBuiltDist, PathSourceDist, RegistryBuiltDist, GitSourceDist, IndexUrl, ParsedArchiveUrl, ParsedGitUrl, PathBuiltDist, PathSourceDist,
RegistryBuiltWheel, RegistrySourceDist, Resolution, ResolvedDist, ToUrlError, RegistryBuiltDist, RegistryBuiltWheel, RegistrySourceDist, Resolution, ResolvedDist,
ToUrlError,
}; };
use pep440_rs::Version; use pep440_rs::Version;
use pep508_rs::{MarkerEnvironment, VerbatimUrl}; use pep508_rs::{MarkerEnvironment, VerbatimUrl};
@ -310,9 +311,10 @@ impl Distribution {
.with_precise(git.precise); .with_precise(git.precise);
// Reconstruct the PEP 508-compatible URL from the `GitSource`. // Reconstruct the PEP 508-compatible URL from the `GitSource`.
// TODO(charlie): This shouldn't be necessary; it's only necessary because we're let url = Url::from(ParsedGitUrl {
// still losing the `GitUrl` somewhere along the path to installation. url: git_url.clone(),
let url = Url::from(git_url.clone()); subdirectory: git.subdirectory.as_ref().map(PathBuf::from),
});
let git_dist = GitSourceDist { let git_dist = GitSourceDist {
name: self.id.name.clone(), name: self.id.name.clone(),

View file

@ -300,7 +300,7 @@ fn lock_git() -> Result<()> {
----- stderr ----- ----- stderr -----
Downloaded 4 packages in [TIME] Downloaded 4 packages in [TIME]
Installed 5 packages in [TIME] Installed 5 packages in [TIME]
+ anyio==3.7.0 (from https://github.com/agronholm/anyio@f7a880ffac4766efb39e6fb60fc28d944f5d2f65) + anyio==3.7.0 (from git+https://github.com/agronholm/anyio@f7a880ffac4766efb39e6fb60fc28d944f5d2f65)
+ exceptiongroup==1.2.0 + exceptiongroup==1.2.0
+ idna==3.6 + idna==3.6
+ sniffio==1.3.1 + sniffio==1.3.1