Edgewall Software

Ticket #1781 (new defect)

Opened 3 years ago

Last modified 5 months ago

Link from 'Browser Source' to Subversion Repository URL

Reported by: Ian Leader <__ian.leader__@…> Owned by: cboos
Priority: normal Milestone: 0.13
Component: version control/browser Version: devel
Severity: normal Keywords: url multirepos
Cc:

Description

When browsing source in trac, it would be useful to be able to get the Subversion repository URL for the folder or file you are browsing - for example to check out that sub-tree, or to link directly to a file in the repository.

This would require a parameter with the base URL of the repository to be set in trac.ini as there is no way to automatically deduce the URL. Beyond that I think it would be fairly simple to implement.

I would like to see this at the top of the page e.g.

root/tags/trac-0.8 (subversion repository URL for this page)

or

root/tags/trac-0.8 (<URL spelled out>)

in a smaller font just after the path. However, if this was controversial, a good alternative would be to put it in as an 'alternative format' link.

If there's interest in including this in the trunk, I'm happy to do a patch.

Attachments

Change History

Changed 3 years ago by d.mills@…

I'd be interested in this feature too, but I was wondering: is it possible to code the version into the url? if not, the usefullness of this feature will be seriously limited.

Changed 3 years ago by Ian Leader <__ian.leader__@…>

It isn't possible to specify a revision when accessing an SVN repo in apache using plain HTTP or HTTPS. However, this is still useful in the following cases:

  1. You want to know the URL to put into your svn client to check out or export whatever version you require
  2. You want a URL to link to the latest version of a folder/file

I see this as being as much/more about easily getting a URL to use elsewhere, rather than a way of accessing the svn repo directly through your web browser.

Changed 3 years ago by markus

I agree with Ian. In case you're using the svn:// or svn+ssh:// protocol it is often much more easy to remember a web address of a project instead of a url to a repository.

Changed 3 years ago by Ian Leader <__ian.leader__@…>

After some more thought on this, I propose to implement as follows:

  1. Show a hyperlink to the repository after the 'internal' path on the 'browse source' pages along the following lines:
  2. All subversion protocols (including file://) will be supported
  3. Protocol and URL will be specified in trac.ini in the [trac] section:
    • repository_protocol - will contain the repository protocol (one of file:/// , http://, https://, svn://, svn+ssh://, or blank).
    • repository_URL - URL to the top level of the repository, without the protocol or any leading slash(es) (e.g. svn.edgewall.com/repos/trac/tags/trac-0.8/), or blank

The rationale for separating the protocol from the rest of the URL is to support installations that allow both HTTP and HTTPS access to the repository (e.g. HTTP allowed from the LAN, HTTPS only for external access). If the repository protocol field is set to blank, the repository URL will be formed using the current protocol (HTTP or HTTPS)

If both the repository_protocol and the repository_URL are blank, the link will not appear.

For trac installations operating on a repository subset (see #586), repository_URL specified can be to a sub-folder of the repository, not the top level.

I have a feeling that maybe this should use the versioncontrol layer (see TracDev/VersionControlApi), but the documentation is limited so far, and I can't find mention of version controlprovider implementation-specific configuration parameters, so I'm thinking it's best to go with a simple approach for now.

Changed 3 years ago by anonymous

there is an url to access old revisions, but it is "secrect" i.e. you should not rely on it forever: http://svn.edgewall.com/repos/trac/!svn/bc/1000/tags/

Changed 3 years ago by mgood

  • owner changed from jonas to mgood

Changed 3 years ago by cboos

mgood, if you want to implement this, please don't forget to do that in a VersioningSystemBackend independant way.

For example, in mercurial, there could be a link to the manifest in the mercurial cgi server.

e.g. if the currently browsed path is /mercurial, the link would be: http://www.selenic.com/hg/?mf=aec167b2fe2b;path=/mercurial/ (the mf argument being the current changeset id).

Changed 2 years ago by cboos

  • owner changed from mgood to cboos
  • milestone set to 0.11

Actually, this could be generalized to having a list of "related paths" for the currently browsed path. This would make the implementation doable as a plugin and then the svn backend could do it one way, the Mercurial plugin another way, etc.

Plus this would allow for links to other systems as well, like documentation systems, like the DoxygenPlugin.

Changed 2 years ago by mgood

#4406 has been marked as a duplicate.

Changed 10 months ago by cboos

  • keywords url multirepos added
  • milestone changed from 0.11.1 to 0.12

Related to some of the changes done in the MultipleRepositorySupport branch and per-repository extra configuration (i.e. r6459). We could try to get the 'url' information from the repository options and if set, automatically add the link to the path being browsed using that URL as a base.

Changed 10 months ago by osimons

#6804 closed as duplilcate.

Changed 8 months ago by christer@…

Would something like this be what you want?

http://zoo.weinigel.se/trac/public/browser/trac/repolink/trunk

Try clicking on "Repo" in the context navigation area.

Warning, this is my first attempt at a trac plugin, so it's probably a very crude solution.

Changed 8 months ago by cboos

Yep, more or less (plugins (ab)using IRequestFilter are indicative that the appropriate interface is missing).

Here, you use repository_url, which is fine when there's only one repo. With the MultipleRepositorySupport, this will be part of the per-repository metadata, and there, guessing the appropriate repository from the req.path_info will be more difficult, so I'll integrate that in the BrowserModule itself.

So let's say the repolink plugin is the solution for 0.11 and with 0.12 it won't be necessary (and I'll support "legacy" repository_url as well).

Changed 5 months ago by techtonik <techtonik@…>

I would be against postponing this to 0.12, because even to add patches to Trac itself such information would be very convenient. As you may know windows doesn't have native diff utility and the most convenient way to build a patch is using svn checkout.

Add/Change #1781 (Link from 'Browser Source' to Subversion Repository URL)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cboos. Next status will be 'new'
The owner will change from cboos to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.