Page 1 of 2

SVN post-commit with windows

Posted: 02 Feb 2012, 16:05
by edomal
My system has the following components:

mysql 5.0.51a
PHP 5.3.5
Apache 2.2.21
mantis bt 1.2.28
SVN 1.6.17
websvn 2.3.3
plugins-source-integration 0.13.2-177

I'm in trouble with SVN post-commit hook. I''m working in windows (XP sp3), so the hook script has to ba a .bat file written in a windows good code.
in Source plug-in the post-commit.tmpl is written for linux... Who can help me?

Then if I trie to see http://localhost/mantis/plugin.php?page=Source/checkin I obtain "APPLICATION ERROR #200
A required parameter to this page (api_key) was not found"

Re: SVN post-commit with windows

Posted: 09 Feb 2012, 09:34
by edomal
Hi.

Thank to Alain D'EURVEILHER now everythong works. The post-commit .bat file must be like this:

@ECHO OFF
SETLOCAL
set REPOS="SVNrepo"
set REV=%2
set CHECKINURL="http://localhost/mantis/plugin.php?page=Source/checkin"
C:\server\curl.exe -d "repo_name=%REPOS%" -d "data=%REV%" -d "api_key=1" %CHECKINURL%

where api_key is the same set in the repository configuration!!!

Re: SVN post-commit with windows

Posted: 09 Feb 2012, 10:18
by AlainD.
Perfect! :wink:

It was a bit difficult for me to set it up at the beginning too, but it's really worth it to spend some time to make it work!
Enjoy the rest...

I could give you some more tips maybe for WebSVN to make the mantis tiket in the log message clickable and linked to mantis ;-)
Ha... but I just realized that it's already handled in the last version 2.3.3 of WebSVN (I used the 2.3.2 which does not support it...). So I guess it's all fine then.

Re: SVN post-commit with windows

Posted: 05 Oct 2012, 05:29
by jagtap.suhas
Have integrated Mantis 1.2.x and subversion properly using above bat file.
But i need help on updating multiple issues at the same commit.
When i provide multiple bugs separated by comma while committing in svn (Tortoise svn). It doesn't write anything in second bug number.

Re: SVN post-commit with windows

Posted: 05 Oct 2012, 06:41
by AlainD.
I'm using the following regexp in the configuration of the Mantis plugin 'source control':

Bug Link Regex Pass 1:

Code: Select all

/(?:bugs?|issues?|reports?)+:?\s+(?:#(?:\d+)[,\.\s]*)+/i
Bug Link Regex Pass 2:

Code: Select all

/#?(\d+)/
And it works fine for me.
For each mantis issue number, the # is mandatory. Thus, for me:
"#1203, 1204, #1205" will attach the commit only in the tickets 1203 and 1205, not in 1204.

Re: SVN post-commit with windows

Posted: 05 Oct 2012, 10:02
by jagtap.suhas
/(?:bugs?|issues?|reports?)+:?\s+(?:#(?:\d+)[,\.\s]*)+/i
This one is not working for me.... :(

Currently i am using Following regex, which is working for single bug id.

Bug Link Regex Pass 1:- /\b(?:bug|issue|task)\s*[#]{0,1}(\d+)\b/i
Bug Fixed Regex Pass 1:- /\bfix(?:ed|es)\s+(?:bug|issue|task)?\s*[#]{0,1}(\d+)\b/i

Any idea ?

Re: SVN post-commit with windows

Posted: 05 Oct 2012, 11:15
by AlainD.
Before we analyze, can also paste here a log message you use with several mantis ID ?
thx.

Re: SVN post-commit with windows

Posted: 05 Oct 2012, 11:31
by AlainD.
jagtap.suhas wrote:/(?:bugs?|issues?|reports?)+:?\s+(?:#(?:\d+)[,\.\s]*)+/i
This one is not working for me.... :(

Currently i am using Following regex, which is working for single bug id.

Bug Link Regex Pass 1:- /\b(?:bug|issue|task)\s*[#]{0,1}(\d+)\b/i
Bug Fixed Regex Pass 1:- /\bfix(?:ed|es)\s+(?:bug|issue|task)?\s*[#]{0,1}(\d+)\b/i

Any idea ?
anyway... I can see why, because your pattern only take into account one occurence of an issue id: [#]{0,1}(\d+)
(which means by the way "one series of digits preceeded by one or no #")
Besides, "[#]{0,1}" is better written as: "#?". That's the meaning of the "?" when placed after the letter. So let's use this one instead.

if you want this occurence to be repeated you need to:
- encapsulate the expression in a new pair of parenthesis, for instance: (#?(\d+))
- and specify how many occurences: "+" at least one ? or "*" zero or at least one. Then at the end if we want at least one: (#?(\d+))+

But here we don't take into account yet the separator between the different mantis ID. If you want to use a space, or a comma, you must add also the separator inside. For instance [\s,] for allowing comma or space as separator. Of course it could happen that there is only one mantis issue concerned, so we must use the star * to say that there is zero or more of one character among [\s,]:
(#?(\d+)[,\.\s]*)+

Finally the full expression would be:
Bug Link Regex Pass 1:-

Code: Select all

/\b(?:bug|issue|task)\s*(#?(\d+)[,\.\s]*)+\b/i
Bug Fixed Regex Pass 1:-

Code: Select all

/\bfix(?:ed|es)\s+(?:bug|issue|task)?\s*(#?(\d+)[,\.\s]*)+\b/i
Try this, and tell us back if it's OK.

Re: SVN post-commit with windows

Posted: 05 Oct 2012, 12:48
by jagtap.suhas
Alain,

It worked like charm.. I can able to resolve multiple bugs in same commit , using regex string given by you.
It is very difficult for me to resolve this.

Thank you very much for your time and consideration :D

Re: SVN post-commit with windows

Posted: 22 Oct 2012, 06:23
by peter9091
Hi everyone .... Before we analyze, can also paste here a log message you use with several mantis ID ?

Re: SVN post-commit with windows

Posted: 22 Oct 2012, 20:55
by AlainD.
Hi, is there a question somewhere ? Why do you quote me ?

Re: SVN post-commit with windows

Posted: 23 Oct 2012, 06:59
by atrol
AlainD. wrote:Why do you quote me ?
Maybe he is just trying to enter enough posts to get the right to post without going through moderation. After that, we will get some spam ;-)
Sorry peter (or DaviD?), if I am wrong.

Re: SVN post-commit with windows

Posted: 24 Sep 2013, 09:05
by baitone76
Hi.


I use the following post-commit.bat:

@ECHO OFF
SETLOCAL
set REPOS="MyRep"
set REV=%2
set CHECKINURL="http://myserver:8080/mantis/plugin.php? ... ce/checkin"
'C:\Program Files (x86)\VisualSVN Server\curl.exe' -d "repo_name=%REPOS%" -d "data=%REV%" -d "api_key=37" %CHECKINURL%

But I have the following message:
post-commit hook failed (exit code 1) with output:
direcory, name, or volume label syntax is incorrect


what is wrong?

Please help me!!!

Re: SVN post-commit with windows

Posted: 24 Sep 2013, 10:35
by AlainD.
try using " instead of ' maybe ??
"C:\Program Files (x86)\VisualSVN Server\curl.exe" -d "repo_name=%REPOS%" -d "data=%REV%" -d "api_key=37" %CHECKINURL%

Also check that the path "C:\Program Files (x86)\VisualSVN Server\curl.exe" really exists.

Re: SVN post-commit with windows

Posted: 24 Sep 2013, 10:48
by baitone76
With " instead of ' I havo no errors but it doesn't work. If I look at the mantibt bug I have no changes (fixed i.e) neither in mantis repositories revisions are updated.

I have visualsvn 2.5.1, websvn 2.3.3, mantisbt 1.2.15 .
Visual SVN server uses port 8080.

SVN Repositories folder is C:\Repositories, while SVN folder is C:\Program Files (x86)\VisualSVN Server