How can I make a link to a git branch in Trac's wiki?

304 Views Asked by At

I am using Trac from Edgewall with a couple of git repositories. I would like to create links from the wiki pages into branches of the git repository. Is that possible and if so how?

The source and log markup listed on the TracLinks pages look like they almost do what I need. I cannot figure out how to display anything other than the "main" branch or a specific revision though. It looks like branches are handled as specific revisions in the URL that is generated, what I need is a way to know what the top revision is for each branch and use that in the link.


The help pages suggest that source:/repositoryName/branchName/ should work but it does not for me. It looks like Subversion might have been the default version control system, so perhaps this syntax only works for that and not for git?

source:/repositoryName/ and source:/repositoryName/path/to/aFile work as expected. So far I have tried:

[source:/RepoName/branch/BranchName/]
[source:/RepoName/BranchName/]
[source:/BranchName/]

Without any success. I will start investigating what Macros there are available too. Ideally I would like something working in version 0.12 as that is what I currently have running, a solution for the future would also be acceptable though.

1

There are 1 best solutions below

1
On BEST ANSWER

Using Trac 0.12.x with the GitPlugin or Trac 1.0.x with built-in support for Git, the following works:

browser:repository@branchname
[browser:repository@branchname]

I added some documentation to the wiki.