Ubuntu – Can redmine create repos on its own

mercurialredmineUbuntu

I've setup redmine and have working mercurial repositories.

The hg repos are located in /home/hg/repos so I've set hg as owner to be able to push.

Is it possible to make redmine automatically setup repos when "creating" them in the web UI? There's only one person I can trust with su access on our linux machine but several users should be able to create projects and associated repos. It would be ideal to set this up so redmine automatically creates those repos.

Is this possible? Am I clear enough in my question?

Best Answer

Yes. The reposman.rb script is explicitly meant for this purpose.

Usually it is done calling the above script on a cronjob i.e:

10 * * * * root ruby /root/redmine-1.0.0/extra/svn/reposman.rb --redmine-host http://my.redmine./ --svn-dir /data/svn/ --url my.svn.server --key=mykey --owner apache --verbose >> /var/log/reposman.log 

However, mercurial does not have an equivelent implementation as the above is for SVN (http://www.redmine.org/boards/1/topics/575). It is possible to write your own hooks to accomplish this. If you don't mind modifying the Redmine core you can use the information here as very minimal source of approach on the issue: http://joshua-enfield.blogspot.com/2010/09/adding-your-own-hooks-into-redmine.html

With above method you could call a shell script containing the commands you would normally use to create a repository. This is fully customizable. (A shell script is just a file with execute permissions containing commands as you would type them on the command line). Basically using that guide for creating a repository you would call a script which created a directory by the name of the project identifier cd into that directory and then run hg init You could then use mysql to add the repository automatically to the project identified by the project identifier.

A more elegant solution would be to use the above with native Redmine hooks in a plugin or creating copies of the modified pages in a plugin which would automatically override the Redmine core - http://www.redmine.org/wiki/1/Hooks

If you need to do anything with the database the below is helpful: https://stackoverflow.com/questions/3215902/3284099#3284099

Related Topic