Skip to content

Commit

Permalink
fix: pdm update do not intstall proper revision of git dependency
Browse files Browse the repository at this point in the history
Close #1762

Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Mar 9, 2023
1 parent b3533ce commit ba3c22d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/1762.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug of synchronization of not considering the revision of VCS requirement in comparison.
7 changes: 5 additions & 2 deletions src/pdm/installers/synchronizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pdm.installers.manager import InstallManager
from pdm.models.candidates import Candidate, make_candidate
from pdm.models.environment import Environment
from pdm.models.requirements import Requirement, parse_requirement, strip_extras
from pdm.models.requirements import FileRequirement, Requirement, parse_requirement, strip_extras
from pdm.utils import is_editable, normalize_name

if TYPE_CHECKING:
Expand Down Expand Up @@ -186,7 +186,10 @@ def _should_update(self, dist: Distribution, can: Candidate) -> bool:
return bool(self.no_editable)
if not can.req.is_named:
dreq = Requirement.from_dist(dist)
return getattr(dreq, "url", None) != backend.expand_line(can.req.url) # type: ignore[attr-defined]
if not isinstance(dreq, FileRequirement):
return True
assert can.link is not None
return dreq.get_full_url() != backend.expand_line(can.link.url_without_fragment)
specifier = can.req.as_pinned_version(can.version).specifier
assert specifier is not None
return not specifier.contains(dist.version, prereleases=True)
Expand Down

0 comments on commit ba3c22d

Please sign in to comment.