Skip to content

Commit 33bec96

Browse files
authored
Merge pull request #156 from Microsoft/users/tedchamb/dev
make error message better when trying to autodetect repo info from a repo configured with an ssh url.
2 parents e260430 + 670ae79 commit 33bec96

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/common_modules/vsts-cli-common/vsts/cli/common/vsts_git_url_info.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import logging
88

9-
109
from msrest.serialization import Model
1110
from .file_cache import get_cli_cache
1211
from .uri import uri_parse
@@ -64,6 +63,8 @@ def get_vsts_info(remote_url):
6463
if components.scheme == 'ssh':
6564
# Convert to https url.
6665
netloc = VstsGitUrlInfo.convert_ssh_netloc_to_https_netloc(components.netloc)
66+
if netloc is None:
67+
return None
6768
uri = 'https://' + netloc + '/' + components.path
6869
ssh_path_segment = '_ssh/'
6970
ssh_path_segment_pos = uri.find(ssh_path_segment)
@@ -78,12 +79,19 @@ def get_vsts_info(remote_url):
7879
def convert_ssh_netloc_to_https_netloc(netloc):
7980
if netloc is None:
8081
return None
81-
import re
82-
regex = re.compile('([^@]+)@[^\.]+(\.[^:]+)')
83-
match = regex.match(netloc)
84-
if match is not None:
85-
return match.group(1) + match.group(2)
86-
return None
82+
if netloc.find('@') < 0:
83+
# on premise url
84+
logging.warning('TFS SSH URLs are not supported for repo auto-detection yet. See the following issue for ' +
85+
'latest updates: https://github.com/Microsoft/vsts-cli/issues/142')
86+
return None
87+
else:
88+
# hosted url
89+
import re
90+
regex = re.compile('([^@]+)@[^\.]+(\.[^:]+)')
91+
match = regex.match(netloc)
92+
if match is not None:
93+
return match.group(1) + match.group(2)
94+
return None
8795

8896
@staticmethod
8997
def is_vsts_url_candidate(url):

0 commit comments

Comments
 (0)