Bug 1651813 Comment 5 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to Kartikaya Gupta (email:kats@mozilla.staktrace.com) from comment #3)
> but if you only have the mercurial hash we could hook up an equivalent `/hgrev/<hg-hash>` URL endpoint.

This was done in bug 1669776.

---

One idea would be to change [settings/base.py](https://github.com/mozilla-services/socorro/blob/e5560f039c4077cb5b7a18db95e0c2a658e001bf/webapp-django/crashstats/settings/base.py#L252-L256) from this:

```
    "hg": {
        "hg.mozilla.org": (
            "https://hg.mozilla.org/%(repo)s/file/%(revision)s/%(file)s#l%(line)s"
        )
    },
```

to this:

```
    "hg": {
        "hg.mozilla.org": (
            "https://searchfox.org/%(repo)s/hgrev/%(revision)s/%(file)s#%(line)s"
        )
    },
```

This would work for mozilla-central. For crashes from other branches, e.g. `integration/autoland`, searchfox does not have the code, and this would generate URLs that 404.
So maybe the `vcs_mappings` structure needs to be extended to allow for per-repo URLs, not just per-server URLs.

For example:

```
    "hg": {
        "hg.mozilla.org/mozilla-central": (
            "https://searchfox.org/mozilla-central/hgrev/%(revision)s/%(file)s#%(line)s"
        ),
        "hg.mozilla.org": (
            "https://searchfox.org/%(repo)s/hgrev/%(revision)s/%(file)s#%(line)s"
        )
    },
```

and then instead of

```
link = vcs_mappings[vcstype][server]
```

you'd do

```
server_link = vcs_mappings[vcstype][server]
# See if there is a more specific "server/repo" link format.
server_repo_key = "%s/%s" % (server, repo)
link = vcs_mappings[vcstype].get(server_repo_key, server_link)
```
(In reply to Kartikaya Gupta (email:kats@mozilla.staktrace.com) from comment #3)
> but if you only have the mercurial hash we could hook up an equivalent `/hgrev/<hg-hash>` URL endpoint.

This was done in bug 1669776.

---

One idea would be to change [settings/base.py](https://github.com/mozilla-services/socorro/blob/e5560f039c4077cb5b7a18db95e0c2a658e001bf/webapp-django/crashstats/settings/base.py#L252-L256) from this:

```
    "hg": {
        "hg.mozilla.org": (
            "https://hg.mozilla.org/%(repo)s/file/%(revision)s/%(file)s#l%(line)s"
        )
    },
```

to this:

```
    "hg": {
        "hg.mozilla.org": (
            "https://searchfox.org/%(repo)s/hgrev/%(revision)s/%(file)s#%(line)s"
        )
    },
```

This would work for mozilla-central. For crashes from other branches, e.g. `integration/autoland`, searchfox does not have the code, and this would generate URLs that 404.
So maybe the `vcs_mappings` structure needs to be extended to allow for per-repo URLs, not just per-server URLs.

For example:

```
    "hg": {
        "hg.mozilla.org/mozilla-central": (
            "https://searchfox.org/mozilla-central/hgrev/%(revision)s/%(file)s#%(line)s"
        ),
        "hg.mozilla.org": (
            "https://hg.mozilla.org/%(repo)s/file/%(revision)s/%(file)s#l%(line)s"
        )
    },
```

and then instead of

```
link = vcs_mappings[vcstype][server]
```

you'd do

```
server_link = vcs_mappings[vcstype][server]
# See if there is a more specific "server/repo" link format.
server_repo_key = "%s/%s" % (server, repo)
link = vcs_mappings[vcstype].get(server_repo_key, server_link)
```

Back to Bug 1651813 Comment 5