Mozilla Repository URLs

0.2.2 · active · verified Mon Apr 13

Mozilla Repo URLs is a Python library designed to process and centralize the parsing of Mozilla's repository URLs. It provides utilities to break down complex repository URLs into their constituent parts, aiding in automation and consistent handling across various Mozilla projects. The current version is 0.2.2, and it typically sees releases tied to internal Mozilla development needs rather than a fixed public cadence.

Warnings

Install

Imports

Quickstart

The primary function `parse` takes a Mozilla repository URL string and returns a dictionary containing its parsed components, such as 'base', 'repo', 'path', 'revision', and 'type'.

from mozilla_repo_urls import parse

# Example Mozilla repository URL
repo_url = "https://hg.mozilla.org/mozilla-central/file/tip/README.md"

parsed_data = parse(repo_url)

print("Original URL:", repo_url)
for key, value in parsed_data.items():
    print(f"{key}: {value}")

# Another example
repo_url_2 = "https://hg.mozilla.org/try/rev/abcdef123456"
parsed_data_2 = parse(repo_url_2)

print("\nOriginal URL 2:", repo_url_2)
for key, value in parsed_data_2.items():
    print(f"{key}: {value}")

view raw JSON →