From 4e0c2f4d386ff1c1664560ef3584fcd1aa1892bf Mon Sep 17 00:00:00 2001 From: Dan Rose Date: Mon, 20 Apr 2020 11:21:35 -0500 Subject: [PATCH] Fix unsupported repo type (#126) previously: ``` echo 'repositories: {somedir: {type: foo, url: aoeu}}' | vcs import . Traceback (most recent call last): File "/home/dan/.local/bin/vcs", line 11, in load_entry_point('vcstool', 'console_scripts', 'vcs')() File "/home/dan/Documents/colcon/src/vcstool/vcstool/commands/vcs.py", line 26, in main return entrypoint(args) File "/home/dan/Documents/colcon/src/vcstool/vcstool/commands/import_.py", line 203, in main url = job['command'].url AttributeError: 'NoneType' object has no attribute 'url' ``` now: ``` echo 'repositories: {somedir: {type: foo, url: aoeu}}' | vcs import . === ./somedir (none) === Repository type 'foo' is not supported ``` --- vcstool/commands/import_.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vcstool/commands/import_.py b/vcstool/commands/import_.py index b50c0d3f..d31318a6 100644 --- a/vcstool/commands/import_.py +++ b/vcstool/commands/import_.py @@ -200,6 +200,8 @@ def main(args=None, stdout=None, stderr=None): ssh_keygen = None checked_hosts = set() for job in list(jobs): + if job['command'] is None: + continue url = job['command'].url # only check the host from a ssh URL if not url.startswith('git@') or ':' not in url: