-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,6 @@ | |
|
||
_svn_xml_url_re = re.compile('url="([^"]+)"') | ||
_svn_rev_re = re.compile(r'committed-rev="(\d+)"') | ||
_svn_url_re = re.compile(r'URL: (.+)') | ||
_svn_revision_re = re.compile(r'Revision: (.+)') | ||
_svn_info_xml_rev_re = re.compile(r'\s*revision="(\d+)"') | ||
_svn_info_xml_url_re = re.compile(r'<url>(.*)</url>') | ||
|
||
|
@@ -31,34 +29,6 @@ class Subversion(VersionControl): | |
def get_base_rev_args(self, rev): | ||
return ['-r', rev] | ||
|
||
def get_info(self, location): | ||
"""Returns (url, revision), where both are strings""" | ||
assert not location.rstrip('/').endswith(self.dirname), \ | ||
'Bad directory: %s' % location | ||
output = self.run_command( | ||
['info', location], | ||
show_stdout=False, | ||
extra_environ={'LANG': 'C'}, | ||
) | ||
match = _svn_url_re.search(output) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can |
||
if not match: | ||
logger.warning( | ||
'Cannot determine URL of svn checkout %s', | ||
display_path(location), | ||
) | ||
logger.debug('Output that cannot be parsed: \n%s', output) | ||
return None, None | ||
url = match.group(1).strip() | ||
match = _svn_revision_re.search(output) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can |
||
if not match: | ||
logger.warning( | ||
'Cannot determine revision of svn checkout %s', | ||
display_path(location), | ||
) | ||
logger.debug('Output that cannot be parsed: \n%s', output) | ||
return url, None | ||
return url, match.group(1) | ||
|
||
def export(self, location): | ||
"""Export the svn repository at the url to the destination location""" | ||
url, rev_options = self.get_url_rev_options(self.url) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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 thanget_info()
because it attempts to read the URL from disk before falling back to spawning asvn info
child process (which is allget_info()
does).Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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 likeget_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.There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying!