Skip to content
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

Detect all registered VCS and choose inner-most #7593

Merged
merged 11 commits into from
Feb 8, 2020

Conversation

uranusjr
Copy link
Member

Fix #3988.

The idea (as describe in #3988 (comment)) is to test all VCS, and choose the one that controls the inner-most directory as root. Git provides this value via git rev-parse --show-toplevel, and Mercurial hg root.

The implementation seems to work from my limited testing, but there are still much to do. A test, at least. And the VCS code modified in this PR probably could use some refactoring as well.

except BadCommand:
logger.debug("could not determine if %s is under git control "
"because git is not available", location)
return False
return None
except InstallationError:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems weird, I'd say call_subprocess should not raise InstallationError which is too high-level.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is definitely not right, but I’d say this belongs to another (refactoring) PR. Note that the Mercurial implementation already catches InstallationError right now.

@uranusjr
Copy link
Member Author

uranusjr commented Feb 7, 2020

Soft ping, I believe I have addressed all comments. There are a few follow-up improvements I am looking to do after this.

Copy link
Member

@chrahunt chrahunt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor comments, otherwise this looks good to me.

src/pip/_internal/vcs/versioncontrol.py Outdated Show resolved Hide resolved
src/pip/_internal/vcs/versioncontrol.py Outdated Show resolved Hide resolved
Co-Authored-By: Christopher Hunt <[email protected]>
Copy link
Member

@sbidoul sbidoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pradyunsg pradyunsg merged commit 313740f into pypa:master Feb 8, 2020
@uranusjr
Copy link
Member Author

uranusjr commented Feb 8, 2020

Thanks all!

@uranusjr uranusjr deleted the hg-under-git branch February 8, 2020 12:57
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Mar 10, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip freeze fails to properly return hg URL if virtualenv is under Git controlled project
5 participants