-
Improvement
-
Resolution: Fixed
-
Minor
-
Jenkins 1.441, Trac Plugin 1.12
-
Powered by SuggestiMate
In the Trac Plugin documentation the configuration is described as
In the Source Code Management section, choose "Trac" for the "Repository browser" setting.
This settings "Trac" is not available for when I use git as a SCM.
Can this selection be added?
The Trac-plugin code supports "TracGit" for the "Repository browser" setting. The given Trac URL at the top of the job settings will be used to generate links for git changesets, files and diffs to your Trac "Browse Source" area.
[JENKINS-11887] Support Git for "Repository browser" setting
Now I found my way through the GitChangeSet, ChangeLogSet.Entry, ChangeLogSet classes and the build field to the project to access the Trac URL in the same way as in the existing TracRepositoryBrowser class.
The new code is pushed into this branch https://github.com/GerdZanker/trac-plugin/tree/JENKINS-11887
Finished implementation with changeset https://github.com/GerdZanker/trac-plugin/commit/c9439100a4f9e8e8ca2fbc330237063797572c0f in https://github.com/GerdZanker/trac-plugin/tree/JENKINS-11887
Integrated in plugins_trac #17
JENKINS-11887 implemented a Trac Git Browser class for the trac plugin (Revision d69d6087dc4f46c4351772bb1edc86b972748f1b)
[FIXED JENKINS-11887] Cleanup code comments, checked successful test execution (Revision c9439100a4f9e8e8ca2fbc330237063797572c0f)
Result = SUCCESS
Gerd :
Files :
- src/test/resources/hudson/plugins/trac/rawchangelog
- src/test/java/hudson/plugins/trac/TracGitRepositoryBrowserTest.java
- src/main/java/hudson/plugins/trac/TracGitRepositoryBrowser.java
- src/main/resources/hudson/plugins/trac/TracGitRepositoryBrowser/config.jelly
- src/test/resources/hudson/plugins/trac/rawchangelog-with-deleted-file
- pom.xml
Gerd :
Files :
- src/main/java/hudson/plugins/trac/TracGitRepositoryBrowser.java
- src/test/java/hudson/plugins/trac/TracGitRepositoryBrowserTest.java
Integrated in plugins_trac #18
[FIXED JENKINS-11887] and changed the mandatory git-plugin dependency into an optional dependency. (Revision b2c204b0d9dcdc92de9c446cadcc63a10db0da5c)
Result = SUCCESS
Gerd :
Files :
- src/main/java/hudson/plugins/trac/TracGitRepositoryBrowser.java
I updated to 1.13 and I now see Trac as a repository browser option - great! However, the problem now is that the repository name itself is being omitted from the url of displayed files such as in recent changes. Only the path to the file is included resulting in incorrect urls. So for example, I get this incorrect url:
http://trac.mycompany.com/browser/myfile.py
instead of this correct url:
Hello Rob,
is there a Trac configuration to include the repository name or supports Trac multiple repositories?
I only know Trac sites where one git repository is integrated, for example
https://fedorahosted.org/eclipse-fedorapackager/
and therefore file urls are e.g.
https://fedorahosted.org/eclipse-fedorapackager/browser/pom.xml
If the repository name would be included here it would result in this invalid url https://fedorahosted.org/eclipse-fedorapackager/browser/eclipse-fedorapackager/pom.xml.
Do you have ideas?
Bye, bye,
Gerd
Our Trac setup is for multiple git repositories. And so the repo name must be included in the browser url. More details can be found here: http://trac.edgewall.org/wiki/0.12/TracRepositoryAdmin
However, there is one exception to this which is a partial workaround. You can alias the default (i.e., nameless) path to go to a single git repo. This should mostly work for us as we have one main git repo that we care about most for jenkins. But this would just be a workaround for this special case. Full multi-repo support would be better.
Hi Rob,
Thanks for the information. I'm no Trac admin and therefore did not know these "internals". After reading your link I checked the old open JENKINS-7032 issue and it looks like its describing the same problem for subversion repositories. What do you think?
I can apply the patch of JENKINS-7032 to the subversion and git repository browser. But I can't test the changes because I found no a public Trac site with multiple repositories.
Do you know a public Trac site or can you do some tests (I can provide a new Trac.hpi for testing)?
Bye, Bye,
Gerd
Gerd, sorry but I don't know of any public git multi-repository Trac instances. I would be willing to test locally here though.
BTW, issue JENKINS-7032 does not seem to be the same issue as this one.
Can you please explain why the two issues are different? From where to get the repo Name?
In the old issue the User has to enter the repo name and it will be added to the url (after Browser, before file).
Isn't this what you need too?
– Posted from Bugbox for Android
I debugged the code from the other patch. You are right - issue JENKINS-7032 not the same as this one. It will remove a part from the URL and you want to add a part to the URL.
So there is one question open: From where to get the repository Name?
Shall the repo name be derived from the git URL setting in Job configuration? => I can access the URL but I need a matching pattern to get the name from the url.
Is it always a the same repo name for one Jenkins Job? => I could add an optional text field to the Trac settings of the Job configuration to enter the name, which would be an easy task.
Attached trac-1.14-SNAPSHOP build for testing. For Git it can add a string after the Trac URL for browsing the source code (http://trac.mycompany.com/browser/<append>) This shall support multiple repositories within one Trac site.
Hello Rob,
do you have any feedback about the SNAPSHOP version?
Bye,
Gerd
Hi Gerd,
I am looking for the identical feature for svn urls. The repository stays the same for one Jenkins job. Hence an additional settings input field for the trac repository name would do perfectly.
Bernhard
Wrap up (after times of testing and learning for me):
This ticket was to get an initial git support for the Trac plugin. From my point of view this goal is reached.
But two issues are open:
- Multiple repositories URL in the same job in combination with a Trac setup for multiple git repositories.
- Trac browser URL can not always be created by appending the Trac URL and the changed file path.
Sometimes the file path must be truncated (see JENKINS-7032), sometime the file path must be extended by a prefix.
I will now close this issue and create two new ones (JENKINS-13365 and JENKINS-13366) to follow up the two different concerns separately.
Gerd
I started to read the plugin tutorial to handle this issues on my own.
But I find it very difficult to access the Trac URL within an own class derived from GitRepositoryBrowser in the trac-plugin. Therefore I started with the git-plugin forked it and followed the usual pattern in the hudson.plugins.git.browser package.
See https://github.com/GerdZanker/git-plugin/tree/JENKINS-11887