def get_repo_url_from_remote()

in pr2relnotes.py [0:0]


def get_repo_url_from_remote():
    """
    Function that gets the repository URL from the `git remote` listing
    """
    git_remote_bytes = subprocess.check_output(["git", "remote", "-v"])
    # check_output returns the command results in raw byte format
    remote_string = git_remote_bytes.decode('utf-8')

    pattern = re.compile(r"github.com[/:]\w+/\w+")
    m = re.search(pattern, remote_string)
    if m:
        return m.group(0)
    else:
        raise Exception("Incorrect rexex pattern finding repo url")