SVN post-commit with windows

General discussion of Mantis.

Moderators: Developer, Contributor

edomal
Posts: 12
Joined: 31 Jan 2012, 07:58

SVN post-commit with windows

Post 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"
edomal
Posts: 12
Joined: 31 Jan 2012, 07:58

Re: SVN post-commit with windows

Post 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!!!
Last edited by edomal on 09 Feb 2012, 10:20, edited 1 time in total.
AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post 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.
AlainD.
ti lamp, ti lamp n'arivé!
Mantis: 1.2.5
PHP: 5.2.0
OS: Linux (etch)
Plugins: MantisGanttChart | Mantis Graphs | Source Control Integration | Subversion / WebSVN Integration
jagtap.suhas
Posts: 7
Joined: 09 Mar 2012, 12:07

Re: SVN post-commit with windows

Post 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.
AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post 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.
AlainD.
ti lamp, ti lamp n'arivé!
Mantis: 1.2.5
PHP: 5.2.0
OS: Linux (etch)
Plugins: MantisGanttChart | Mantis Graphs | Source Control Integration | Subversion / WebSVN Integration
jagtap.suhas
Posts: 7
Joined: 09 Mar 2012, 12:07

Re: SVN post-commit with windows

Post 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 ?
AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post by AlainD. »

Before we analyze, can also paste here a log message you use with several mantis ID ?
thx.
AlainD.
ti lamp, ti lamp n'arivé!
Mantis: 1.2.5
PHP: 5.2.0
OS: Linux (etch)
Plugins: MantisGanttChart | Mantis Graphs | Source Control Integration | Subversion / WebSVN Integration
AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post 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.
AlainD.
ti lamp, ti lamp n'arivé!
Mantis: 1.2.5
PHP: 5.2.0
OS: Linux (etch)
Plugins: MantisGanttChart | Mantis Graphs | Source Control Integration | Subversion / WebSVN Integration
jagtap.suhas
Posts: 7
Joined: 09 Mar 2012, 12:07

Re: SVN post-commit with windows

Post 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
peter9091
Posts: 1
Joined: 22 Oct 2012, 06:20

Re: SVN post-commit with windows

Post by peter9091 »

Hi everyone .... Before we analyze, can also paste here a log message you use with several mantis ID ?
AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post by AlainD. »

Hi, is there a question somewhere ? Why do you quote me ?
AlainD.
ti lamp, ti lamp n'arivé!
Mantis: 1.2.5
PHP: 5.2.0
OS: Linux (etch)
Plugins: MantisGanttChart | Mantis Graphs | Source Control Integration | Subversion / WebSVN Integration
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: SVN post-commit with windows

Post 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.
Please use Search before posting and read the Manual
baitone76
Posts: 8
Joined: 24 Sep 2013, 09:01

Re: SVN post-commit with windows

Post 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!!!
AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post 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.
AlainD.
ti lamp, ti lamp n'arivé!
Mantis: 1.2.5
PHP: 5.2.0
OS: Linux (etch)
Plugins: MantisGanttChart | Mantis Graphs | Source Control Integration | Subversion / WebSVN Integration
baitone76
Posts: 8
Joined: 24 Sep 2013, 09:01

Re: SVN post-commit with windows

Post 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
Post Reply