Fisheye - how to retrieve tip of branch raw file contents
Asked by Martin Lichtin:

Can you clarify the semantics of the "r" value for raw access:

http://\<fisheye-url-and-context\>/browse/\~raw,r=HEAD/\<repository-name\>/\<full-file-path\>

what does "HEAD" actually stand for (assuming a Git repository).  

Also what should I set r= to retrieve the tip of a branch?

I tried r=\<branch-name\> but this would not reliably work, it seemed to work for some time and then stopped.  


Answers:
author: Martin Lichtin
body: Thanks for the information, much appreciated.

So what I'm doing, using a branch name, should already work. We work in a branch called "dev". So

http://host:8060/browse/\~raw,r=dev/path/file.html

should work, but doesn't.It returns error "The requested resource cannot be found.No revision found dev".

Trying with r=HEAD

http://host:8060/browse/\~raw,r=HEAD/path/file.html

returns contents, but not the latest revision.

Btw, how do find out what the default branch is?

comments: author: Piotr Swiecicki
body: Re "dev" branch - that's weird, should work fine if /path/file.html lives on that branch. Do you want to contact our support via support.atlassian.com perhaps, so we can investigate in detail?Re "HEAD" - that should be the latest revision on the default branch, assuming that was indexed in FishEye. Are you sure your repository has the polling enabled and you can see the changes you are after in the activity stream?Finally, regarding default branch. What fisheye does is simply running git remote show \<\<REMOTE_URL\>\> and extracts default branch name from line starting with "HEAD branch".You can check that manually, for example for AUI repository you would use the following command:$ git remote show git@bitbucket.org:atlassian/aui.git \| grep 'HEAD branch' HEAD branch: master


author: Martin Lichtin
body: Providing the branch name to r= seems to work only intermittently.For example, after a new revision has been committed for this file, it now works again. Not sure for how long..About the default branch, we don't have that set:$ git remote show ssh://git@git/my.git/\* remote ssh://git@git/my.git/ Fetch URL: ssh://git@git/my.git/ Push URL: ssh://git@git/my.git/ HEAD branch: (unknown)


author: Piotr Swiecicki
body: Re intermittent problems - that's really weird, could you contact our support on <http://support.atlassian.com> please? We'd need to take a closer look, perhaps when you have debugging enabled and experience such behaviour.Re default branch - if default branch is not set then most likely HEAD revision would not be properly resolved to a concrete changeset id. You may want to consider setting up default branch on remote repository, you can do that easily with git symbolic-ref command, see <https://confluence.atlassian.com/display/FISHKB/Setting+a+valid+HEAD+on+your+Git+repository>Hope that helps,


author: Piotr Swiecicki
body: Hi @Martin Lichtin,

The r parameter accepts few possible values: "HEAD", changeset id/commit hash (full or short), branch name or tag name.

The meaning of "HEAD" is the default branch name for particular repository. While looking at this question I've realised there is a bug related to git repositories though, in some circumstances FishEye may not know what the default branch name is and mail fail with "No revision found HEAD" error if r=HEAD/... parameter is used. I've just raised a bug <https://jira.atlassian.com/browse/FE-5594> to get this fixed, you will find more information on the issue, feel free to watch it to get notification when the bug is resolved.

Now coming back to your second question, in order to retrieve the tip of a branch you should be able to provide r=\<branch-name\> parameter exactly as you guessed. It seems to be working fine for me, see for instance:

* [https://fisheye4.atlassian.com/browse/\~raw,r=master/activeobjects-git/pom.xml](https://fisheye4.atlassian.com/browse/~raw,r=master/activeobjects-git/pom.xml)
* [https://fisheye4.atlassian.com/browse/\~raw,r=v0.29.x/activeobjects-git/pom.xml](https://fisheye4.atlassian.com/browse/~raw,r=v0.29.x/activeobjects-git/pom.xml)
* [https://fisheye4.atlassian.com/browse/\~raw,r=v0.27.x/activeobjects-git/pom.xml](https://fisheye4.atlassian.com/browse/~raw,r=v0.27.x/activeobjects-git/pom.xml)

I don't know what do you mean by
> it seemed to work for some time and then stopped.

Can you please provide more details, what error do you get if any, why do you think it doesn't work?

Hope that helps,  
Piotr