Skip to content

Fix pip freeze not showing correct entry for mercurial packages that use subdirectories. #7072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Oct 12, 2019
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/pip/_internal/vcs/mercurial.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.vcs.versioncontrol import VersionControl, vcs
from pip._internal.exceptions import BadCommand

if MYPY_CHECK_RUNNING:
from pip._internal.utils.misc import HiddenText
Expand Down Expand Up @@ -111,5 +112,16 @@ def is_commit_id_equal(cls, dest, name):
"""Always assume the versions don't match"""
return False

@classmethod
def controls_location(cls, location):
if super(Mercurial, cls).controls_location(location):
return True
try:
r = cls.run_command(['identify'], cwd=location, show_stdout=False, extra_ok_returncodes=[255])
return not r.startswith('abort:')
except BadCommand:
logger.debug("could not determine if %s is under hg control "
"because hg is not available", location)
return False

vcs.register(Mercurial)