{"id":5329,"library":"mozilla-repo-urls","title":"Mozilla Repository URLs","description":"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.","status":"active","version":"0.2.2","language":"en","source_language":"en","source_url":"https://github.com/mozilla-releng/mozilla-repo-urls","tags":["mozilla","url parsing","repository","developer tools"],"install":[{"cmd":"pip install mozilla-repo-urls","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"symbol":"parse","correct":"from mozilla_repo_urls import parse"}],"quickstart":{"code":"from mozilla_repo_urls import parse\n\n# Example Mozilla repository URL\nrepo_url = \"https://hg.mozilla.org/mozilla-central/file/tip/README.md\"\n\nparsed_data = parse(repo_url)\n\nprint(\"Original URL:\", repo_url)\nfor key, value in parsed_data.items():\n    print(f\"{key}: {value}\")\n\n# Another example\nrepo_url_2 = \"https://hg.mozilla.org/try/rev/abcdef123456\"\nparsed_data_2 = parse(repo_url_2)\n\nprint(\"\\nOriginal URL 2:\", repo_url_2)\nfor key, value in parsed_data_2.items():\n    print(f\"{key}: {value}\")","lang":"python","description":"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'."},"warnings":[{"fix":"Always validate input URLs to ensure they conform to expected Mozilla repository URL structures before passing them to `parse`. Consult Mozilla's internal documentation for precise URL patterns if encountering issues.","message":"The `parse` function is specifically designed for URLs following Mozilla's repository patterns. Inputting non-Mozilla or malformed URLs may result in unexpected or incomplete parsing results, potentially returning `None` for certain keys or raising exceptions for severely invalid formats.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Implement robust error handling and check for the presence of expected keys in the returned dictionary before accessing their values. Consider providing default values or branching logic based on the 'type' key if multiple URL patterns are processed.","message":"The structure of the returned dictionary from `parse` depends on the type of Mozilla repository URL. Different URL formats (e.g., `hg.mozilla.org/mozilla-central`, `hg.mozilla.org/try`) may yield different sets of keys (e.g., 'revision' might be present for a specific commit URL but not for a base repository URL).","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}