Skip to content

Remove vestigial VersionControl.get_info() method. #5614

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 2 commits into from
Jul 22, 2018

Conversation

barneygale
Copy link
Contributor

I can't see that this method is ever called.

@xavfernandez xavfernandez requested a review from cjerdonek July 19, 2018 12:00
@xavfernandez xavfernandez added the skip news Does not need a NEWS file entry (eg: trivial changes) label Jul 19, 2018
@@ -422,7 +414,7 @@ def get_url(self, location):
"""
Return the url used at location

This is used in get_info() and obtain().
This is used in obtain().
Copy link
Member

Choose a reason for hiding this comment

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

I would add get_src_requirement().

Copy link
Member

Choose a reason for hiding this comment

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

We can just remove the "used in" comment IMO. It's easy enough to understand what this method is for without having to mention which other methods use it.

(that can't be said about some other methods)

Copy link
Member

@cjerdonek cjerdonek left a comment

Choose a reason for hiding this comment

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

Approved after addressing comments.

show_stdout=False,
extra_environ={'LANG': 'C'},
)
match = _svn_url_re.search(output)
Copy link
Member

Choose a reason for hiding this comment

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

Can _svn_url_re now also be deleted?

logger.debug('Output that cannot be parsed: \n%s', output)
return None, None
url = match.group(1).strip()
match = _svn_revision_re.search(output)
Copy link
Member

Choose a reason for hiding this comment

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

Can _svn_revision_re now also be deleted?

@@ -31,34 +31,6 @@ class Subversion(VersionControl):
def get_base_rev_args(self, rev):
return ['-r', rev]

def get_info(self, location):
Copy link
Member

Choose a reason for hiding this comment

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

For getting the URL, I wonder which is better, the logic being deleted here or the logic in get_url()? This logic looks a bit simpler FWIW. It's curious that it's different because they're both supposed to do the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get_url() relies on _get_svn_url_rev() to do its dirty work. I think _get_svn_url_rev() is more complicated than get_info() because it attempts to read the URL from disk before falling back to spawning a svn info child process (which is all get_info() does).

Copy link
Member

@cjerdonek cjerdonek Jul 20, 2018

Choose a reason for hiding this comment

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

That was more or less my assessment, too. I wonder if we should consider simplifying svn's get_url() implementation in the future with something more like get_info() (but not for this PR, of course). get_info() is simpler because it relies only on svn's command API instead of what looks like parsing svn implementation details that seem to vary from version to version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the intention is that reading from disk is orders of magnitude faster than launching a child process, otherwise the original author wouldn't have bothered!

Copy link
Member

Choose a reason for hiding this comment

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

It’s certainly possible. But without seeing a code comment, issue discussion, or asking the author, I’m not sure we can say for sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand the appeal of replacing a fast and well-tested method with one that hasn't been used in several years and which unconditionally (and usually unnecessarily) spawns a child process. Pip is slow enough already and I'd rather withdraw this PR than be forced to make it even slower for the sake of removing a vestigial method.

Copy link
Member

Choose a reason for hiding this comment

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

and I'd rather withdraw this PR than be forced to make it even slower for the sake of removing a vestigial method.

I wasn't suggesting that you change your PR. I said, "I wonder if we should consider simplifying svn's get_url() implementation in the future..." and "not for this PR, of course." It was an observation / idea. I approved your PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for clarifying!

@barneygale
Copy link
Contributor Author

It looks like the last (only?) thing to call get_info() was pip's bundling functionality, which was removed in #1806.

@cjerdonek
Copy link
Member

It looks like the last (only?) thing to call get_info() was pip's bundling functionality, which was removed in #1806.

Yeah, I researched that, too, when I reviewed your change. Thanks for double-checking.

@barneygale
Copy link
Contributor Author

Thanks for double-checking.

I wasn't double-checking - I was putting this info on github for posterity.

@cjerdonek
Copy link
Member

Okay, well thanks for posting it on GitHub then. I was just trying to express appreciation for taking the time to look into it.

@pradyunsg pradyunsg merged commit c81597b into pypa:master Jul 22, 2018
@pradyunsg
Copy link
Member

Thanks @barneygale! ^>^

@lock
Copy link

lock bot commented Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
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 skip news Does not need a NEWS file entry (eg: trivial changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants