-
Notifications
You must be signed in to change notification settings - Fork 89
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
Allow fetching repos from url #123
Conversation
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.
Beside the inline comments please also add tests covering the new feature.
@@ -33,12 +38,20 @@ def __init__(self, args, url, version=None, recursive=False): | |||
self.recursive = recursive | |||
|
|||
|
|||
def file_or_url_type(x): | |||
try: | |||
return urlopen(x) |
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.
In case the URL parsing raises an exception a stacktrace is shown which isn't user friendly. Please catch the relevant exceptions and print a single line error message.
def get_parser(): | ||
parser = argparse.ArgumentParser( | ||
description='Import the list of repositories', prog='vcs import') | ||
group = parser.add_argument_group('"import" command parameters') | ||
group.add_argument( | ||
'--input', type=argparse.FileType('r'), default=sys.stdin) | ||
'--input', type=file_or_url_type, default='-', |
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.
The loading of the URL should happen and arg parsing since it could take an arbitrary amount of time. Considering the case that e.g. completion is being computed using parse_known_args
, Please move it loading of the URL post arg parsing.
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.
Unrelated question: why does the patch change the default
argument?
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.
Because argparse formats it weird otherwise in vcs --help
. -
is another name for stdin.
You have previously objected when I've added tests and features in the same PR. Would you still like me to add tests? |
I doubt that I have ever made such a statement - to not add tests for the feature being added in the PR.
Yes. |
@rotu Since it has been a month I just wanted to check if you are planning to follow up on this ticket or if not close the ticket for now. |
It's still a draft since the test coverage is not comprehensive and not a high priority right now. Due to personal stuff, I'm not sure if I'll be able to wrap this up any time soon. I'm sorry - I really want to give this the attention it deserves. If you want to pick up where I left off, I wouldn't mind. |
Superseded by #155. |
If a URL is passed to --input, we fetch the resource. This removes the need for curl or wget in many cases.