InDefero

Sign in or create your account | Project List | Help

Issue 239: Commit Log Commands

Reported by Krishnakumar Pooloth, Jun 25, 2009

indefero should support commit log commands for interacting with 
issues database. 
This is implemented in Google Code as described below.
http://code.google.com/p/support/wiki/IssueTracker#Integration_with_v
ersion_control

Comment 1 by Loïc d'Anterroches, Jun 26, 2009

See the following URL for some way to make a hook in PHP:
http://alt-tag.com/blog/archives/2006/11/integrating-mantis-and-subve
rsion/

Comment 2 by Krishnakumar Pooloth, Jun 26, 2009

The commit hooks on subversion side is well documented.

Probably the most useful commit command is 

Fixes issue NNN (Google code supports 3 variations of this)

Assuming users have same userid in svn as well as indefero 

if there is a issue update script which takes the following 
parameters

1. project name or svn repo location
2. committer name
3. commit log message
4. revision number or revision url
5. Issue Id (may be multiple)

I'm not a php expert. I'm willing to spend some time to get this 
done, if someone can help.

Comment 3 by Loïc d'Anterroches, Jul 12, 2009

Labels: Type:Enhancement, -Type:Defect

Comment 4 by Jacob Moen, Sep 10, 2009

So what you're basically saying here is that we implement this 
ourselves using commit hooks and scripts against the InDefero 
database?

Comment 5 by Jacob Moen, Sep 10, 2009

I misread comment 3.
I'll look into this as well.
Would be nice - no: essential.
My developers are used to using fixes #21 in their commit messages.
It is really awkward to have to go into InDefero each time and 
manually close an issue.

Comment 6 by Jacob Moen, Oct 10, 2009

Just FYI, I've created two regex patterns which seems to do what I 
want:

$preg_string_refs = '/(?:refs|ref|references|see) 
#?(\d+)(\#ic\d*){0,1}(( #?and|#?or|,) #?(\d+)(\#ic\d*){0,1}){0,}/';
$preg_string_closes = '/(?:fix(?:ed|es)|closes|fix) 
#?(\d+)(\#ic\d*){0,1}(( #?and|#?+or|,) #?(\d+)(\#ic\d*){0,1}){0,}/';

These allows me to write something like this:

closes #124 and #123, #98 some other number here ,#9 and refs #145 
and #89 fixes 123, 125, 189 and 999

7 issues are closed, two is referenced. And the #9 is ignored 
(because it's just a number).

Comment 7 by --- boztek, Feb 7, 2010

Has someone actually implemented automatic issue status changes 
through their SCM's commit hook system?

If so could you give a hint as to how one interacts with Indefero to 
perform the status change?

Comment 8 by Brian Armstrong, Feb 11, 2010

I implemented a subversion post-commit hook interface that works for 
set ups where multiple projects are associated with the same 
repository as well as with one to one relationships.

We have a post commit hook in SVN that hits a new API we created 
inside indefero. This new API reads the database to find which 
project that "owns" the commit. Once we have the project, 
we parse the commit message text for issues effected by the commit.

Once we have found the issues, we can do whatever needs doing to 
them.

It's a fairly rudimentary implementation currently. Once we have 
some time to secure the API a little bit and potentially add some 
database logging we are planning on submitting a patch with the 
functionality.

The solution, currently, is not something that should be used in a 
production environment.

Comment 9 by Anthony George, Aug 28, 2010

Brian, any updates? Any possibility of getting even the 
not-ready-for-primetime code?

Comment 10 by Brian Armstrong, Aug 30, 2010

There haven't been any updates to this on my side. We have had less 
time to work on InDefero stuff since we got the custom modifications 
in we wanted for our process.

All of our changes have been merged in with the latest 1.0 release 
as well.

If you are running the latest release (I don't know when this was 
introduced), you should look in the source code at 
./scripts/svn-post-commit

This script was designed for local indefero repositories. If you are 
using a remote SVN repository, you will probably need to set it up a 
basic remote trigger of some sort.

I RECOMMEND USING THE SCRIPTS BUNDLED WITH INDEFERO. I am including 
my diffs for reference only. It is not a robust or good solution, 
just a quick hack.

I have attempted to strip out the revisions that we used for our 
initial svn process log. I haven't tested this diff, so I can't 
promise it will work. You will need to edit 
scripts/create_system_user.php and put in your email, then run the 
script. After that, copy scripts/svn-post-commit-hook.php somewhere 
it will be accessible by the svn repository. Then set up the post 
commit hook in SVN to execute this script something like specified 
in the comments.

It is, by no means, a robust solution. It was a quick hack that 
worked for our needs. We have since switch to using mercurial 
instead of SVN, so I am no longer maintaining any of these changes.

These diffs apply to indefero 0.8.8

Comment 11 by Anthony George, Aug 31, 2010

Thanks Brian.  Before I caught sight of your code, I was able to 
implement my own hack, with essentially the same outcome as 
yours(although yours seems to be up to a better coding standard than 
mine :).  Your diff was a nice reference point though to solve a few 
issues I couldn't get figured out.
Thanks again!

Created: 1 year 2 months ago by Krishnakumar Pooloth

Updated: 10 days 1 hour ago

Status: New

Followed by: 7 persons

Labels:
Priority:Medium
Type:Enhancement