Get web view URL to a commit without knowing the callsign?


#1

Is there a way to get a URL to a commit without knowing the callsign of the repository?

So, for example: I know that I’ve cloned a repository that sits on https://secure.phabricator.com/source/phabricator/, and I want to display the commit 5d54f26daca8 in a browser.

The url to the web view for the commit includes the callsign of the repository: https://secure.phabricator.com/rP5d54f26daca83875d31efda0ab9c52db7cd78652

Is there a way to get a URL for any commit in any repo without knowing it’s callsign? I need it to add support for Phabricator to browse-at-remote.el


#2

The easiest solution is to just run arc browse <commit hash> from somewhere inside the repository. This also works for files, tasks, an other objects.

There are 2 harder ways to handle this:

  1. Use the commit search conduit endpoint - diffusion.commit.search to search for the commit by hash (identifiers).
  2. Use arc which command line tool to get know which repository you’re in, and extract the repository information from there.

There are quite a few ways to understand which repository you’re in, which is why arc which is a complicated workflow.


#3

See also https://secure.phabricator.com/T10667.

Currently, when you type a commit hash in plain text in Remarkup, we link it only if it unambiguously resolves to a single commit.

We have code to resolve ambiguity when multiple commits in a single repository share a prefix: https://secure.phabricator.com/rPbd3c23

Eventually, I’d like to add support for resolving commits across multiple repositories in a similar way. Then we could link raw hashes if they resolved to one or more commits in any number of repositories.

As a side effect, you could use this link target to accomplish your goal here.

This also works today, but isn’t necessarily very stable or reliable:

https://secure.phabricator.com/search/?jump=1&query=5d54f26daca83875d31efda0ab9c52db7cd78652

#4