Skip to content

Microsoft VSTS git url parsing fails #6

Description

@makimat

While using giturlparse with Microsoft VSTS git urls (visualstudio.com), I noticed the parser fails to detect them. They are a bit weird by syntax but git command line tools treat them well.

Example:

>>> from giturlparse import parse
>>> vsts_url = 'https://user:token@myteam.visualstudio.com/MyFirstProject/_git/reponame'
>>> p = parse(vsts_url)
>>> p.host
'user:token@myteam.visualstudio.com/MyFirstProject'
>>> p.owner
'_git'
>>> p.repo
'reponame'
>>> p.domain
'user:token@myteam.visualstudio.com/MyFirstProject'
>>> p.platform
'gitlab'

If it's of any value, here's a regex that I use to match at least https-type VSTS urls. VSTS might provide other url types too.

re.compile('https:\/\/(?:.*@)?(?P<organization>[a-zA-Z0-9]+)\.visualstudio.com\/(?P<project>[^\/]*)\/_(?P<repotype>[^\/]*)\/(?P<repo>.*)')

Version: giturlparse==0.9.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions