SVN post-commit with windows

General discussion of Mantis.

Moderators: Developer, Contributor

AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post by AlainD. »

baitone76 wrote:With " instead of ' I havo no errors but it doesn't work.
Well I'd say that the script works now ! ;-)

Now there is a different issue, the update of the ticket.

For that we'll need more information. Maybe some sscreenshots eventually:
- The message you used for your commit
- The settings of your Mantis pluging (Manage -> Manage Plugins -> Source Control Integration)
- The settings of your repository in Mantis (Repositories -> manage (on the line matching your repo)

Thank you.
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 »

Update
Update
update.JPG (201.87 KiB) Viewed 30882 times
OK, thank you Alan.

Message to commit :

Fixed #12 to test commit

Post-Commit.bat:

@ECHO OFF
SETLOCAL
set REPOS="MAS"
set REV=%2
set CHECKINURL="http://srvcad:8080/mantis/plugin.php?pa ... ce/checkin"
"C:\Program Files (x86)\VisualSVN Server\curl.exe" -d "repo_name=%REPOS%" -d "data=%REV%" -d "api_key=37" %CHECKINURL%
Attachments
config.JPG
config.JPG (197.77 KiB) Viewed 30882 times
AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post by AlainD. »

Hi Edoardo,
I don't know you did it, but you should not use the \b in your regex.

Besides, according to your regular expression, you expect to have
- the word "bug" or "issue" or "item"
- followed by a space or not
- with the mantis ID
- with ot without a # in front of it.

And to specify that the mantis ticket is fixed, you must add the word:
- "Fixed" or "Fixes"
- followed by a space
before your message.


So a correct commit message matching your regex would be something like:
"Fixed issue #12 to test commit"
(but still I don't know whether it'll work perfectly when keeping the \b in your regexp. You should try to remove them and try again.)

Note also that, such a message will also match for the mantis ticket #12:
"issue12"
I suggest you to force the presence of at least one space after issue, and the # character also.



Then,
in the configuration of your repository ([Repositories] -> "MAS" -> [manage]), is possible to use the equivalent "http://" url instead of the "file:///" one ?
Also, I don't know whether you need a username + password to allow the access to your repos, that you will need to check on the configuration of your svn server.

I hope it will help.
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 »

Hi Alain.

I tried without all the "\b"s in regex but no results.
Then I tried to use http://.... instead of C:///... but no results.
Finally I tried to set user + password for svn repository, but no results.

The same thing using Fixed #12 or Fixed bug #12.

It works only doing IMport latest Data manually
AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post by AlainD. »

Maybe yoru curl is not working then... I remember I tried something back in the time to check that but I don't remember how... I'll try to recall that memory.
In the meantime, your could try to search the Internet.

Otherwise you could also log everything your post-commit does.
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 »

How can I log hat my post commit does?
AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post by AlainD. »

Try this in your post-commit script (note sure though about the syntax of the DATE. If it does not work straight, just give the log file name a fixed name.

@ECHO OFF
SETLOCAL
set REPOS="MAS"
set REV=%2
set CHECKINURL="http://srvcad:8080/mantis/plugin.php?pa ... ce/checkin"
set LOGDATE=%DATE:~-4%-%DATE:~4,2%-%DATE:~7,2%
set LOGFILE="c:\Temp\svn_postcommit_%REPOS%_%REV%_%LOGDATE%.log"


"C:\Program Files (x86)\VisualSVN Server\curl.exe" -d "repo_name=%REPOS%" -d "data=%REV%" -d "api_key=37" %CHECKINURL% >> %LOGFILE%

REM DEL %LOGFILE%


Then check in the log file what happened. Once everything works fine, you can remove the "REM" before the DEL command
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 »

This is the log file content:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Authorization Required</title>
</head><body>
<h1>Authorization Required</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
</body></html>

I have no idea.
AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post by AlainD. »

I'd like you to try with this configuration:

Manage Repository:
Name => "MAS"
Type => "WebSVN"
URL => "http://srvcad:8080/svn/MAS"
Extra Info:
websvn_url => "http://srvcad:8080/websvn/"
websvn_name => "MAS"
websvn_path => "/"
svn_username => "valid_username"
svn_password => "user_password"
standard_repo => true
trunk_path => ""
branch_path => ""
tag_path => ""
ignore_paths => false
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 »

It doesn't work!

Log message is again:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Authorization Required</title>
</head><body>
<h1>Authorization Required</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
</body></html>
AlainD.
Posts: 57
Joined: 23 Mar 2011, 14:30
Location: Bruxelles
Contact:

Re: SVN post-commit with windows

Post by AlainD. »

1) can you try by removing the key from the command line with curl ?

2) Also I wonder if your svn server has authorization to access your mantis server...

I'm kinda out of new ideas.. If some other users have other ideas... :)
Thanks.
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. »

So... any progress on your installation ?
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 »

No....
antonyh
Posts: 1
Joined: 21 Nov 2016, 12:22

Re: SVN post-commit with windows

Post by antonyh »

@AlainD

Hope you can help me as you seem to be answering most member queries in this category.

I am new to both Mantis and SVN, but I have begun to investigate how I can integrate the two so my developer colleagues can key their Mantis number at commit stage.

So far I have installed both Mantis1.3.3 and TortoiseSVN1.8.7 onto my Windows laptop. Xampp 3.2.2 is facilitating my Mantis.

Bugtraq properties have been set as follows:

bugtraq:append false
bugtraq:label Bug ID
bugtraq:message Bug ID: %BUGID%
bugtraq:url http://localhost/Mantis/view.php?id=%BUGID%
bugtraq:warnifnoissue true

What I think I need assistance with is the post-commit hook, given my use of TortoiseSVN rather than any web derivative what are the syntax ammendments, this is what I have pulled from previous posts:

@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%

What I am unclear on is the final line "C:\server\curl.exe -d "repo_name=%REPOS%" -d "data=%REV%" -d "api_key=1" %CHECKINURL%"

Can it be done? Is there something else I have missed?

Can you help me?

Regards

antonyh
Post Reply