Opened 20 years ago
Closed 19 years ago
#897 closed enhancement (duplicate)
Support contrib pre&post-commit hooks for SVN(subversion) on Windows
Reported by: | ivanoe | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | general | Version: | devel |
Severity: | normal | Keywords: | contrib hook windows |
Cc: | ivanoe@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Windows shell has some differences compare to the linux ones. One of the limitations is the unability (at least I did not find how to do it) to assign return values from calling other commands. To solve this problem, temporary files can be introduced. In attached files the changes to TRAC as I implemented it. I would like TRAC dev-team to take a review and possibly marge those into trunk, since those can be useful for other users on Windows as well.
The examples of the pre-commit.bat and post-commit.bat in the subversion repositories are also embedded into header comments in the trac-pre-commit-hook and trac-post-commit-hook files.
Also attached are my own subversion hooks.
Note: I am not sure if the component 'general' is correct one. Shall there be 'integration' or something. ivanoe|at|ivanoe.net
Attachments (10)
Change History (25)
by , 20 years ago
Attachment: | trac-pre-commit-hook added |
---|
by , 20 years ago
Attachment: | trac-post-commit-hook added |
---|
changed contrib/trac-post-commit-hook to support message in the file
by , 20 years ago
Attachment: | pre-commit.bat added |
---|
hooks\pre-commit.bat on Windows to support TRAC integration
by , 20 years ago
Attachment: | post-commit.bat added |
---|
hooks\post-commit.bat on Windows to support TRAC integration
comment:1 by , 20 years ago
Keywords: | contrib windows added; subversion removed |
---|---|
Milestone: | 0.8 → 0.9 |
Too late for 0.8.
Please include the diffs to trac-pre-commit-hook
and trac-post-commit-hook
instead of the full files so that it is easier to see what you changed.
comment:2 by , 20 years ago
Milestone: | 0.9 → 0.8 |
---|
cmlenz
You could copy the files into your working environment and see then the differences compare to the base, since I changed the trunk. If you would not like to do that for some reason, I will include the diffs.
comment:5 by , 20 years ago
Milestone: | 0.8 → 0.9 |
---|
I have no idea why the milestone has changed - changed it back to 0.8
comment:6 by , 20 years ago
Owner: | removed |
---|
by , 20 years ago
Attachment: | post-commit.cmd added |
---|
post-commit.cmd fow windows hook (no need to change any thing in trac)
by , 20 years ago
Attachment: | pre-commit.cmd added |
---|
pre-commit hook (no need to change anything in trac)
comment:7 by , 20 years ago
I have attached pre-commit.cmd and post-commit.cmd files they should be in the svn hook directory You have to set the variables:
SET SVN_DIR=C:\Program Files\Subversion SET PYTHON_DIR=C:\Program Files\Python23 SET HOOKS_DIR=C:\… the hook folder of the repository …\hooks SET TRAC_ENV=C:\… trac folder …\trac.db
inside pre-commit.cmd and post-commit.cmd
The use of
FOR /F "usebackq delims==" %%i IN (windows command line call
)
DO SET PARM=%%i
Is the windows strange way of returning resault in variable ( only works on nt and up in CMD mode)
Nir.
comment:8 by , 20 years ago
The scripts do not support multiple projects within one repository. May be there is a way to replace a part of the TRAC_ENV path variable with a part of the repository path. So it would be possible to support multiple projects. I wrote such a script in python but only for my special purposes. I have no idea how to make it more general…
comment:9 by , 20 years ago
What about this one?
REM This is the repository path. (you get it with %1)
SET repospath=c:\svn\test
REM This is the main trac path where the trac projects should be located REM within the same directories like the projects of the multiple repository
SET tracmainpath=c:\trac
REM Replace a part of the repository path you get from subversion.
CALL SET TRAC_ENV=%%repospath:c:\svn=%tracmainpath%%%
comment:10 by , 20 years ago
You can test the return value from a program using IF. my_pre_commit_hook.exe if errorlevel 1 goto failed my_second_commit_hook.exe if errorlevel 1 goto failed rem etc... Use IF/? for help from CMD.
comment:11 by , 20 years ago
Using the hooks and they work perfectly, except for the amail notification, but why is this ticket still open ?
comment:12 by , 20 years ago
The ticket is open until the necessary files have been included in the Trac source so that they are distributed with the release.
comment:13 by , 20 years ago
I'd like to recommend that you folks have a look at http://freshmeat.net/projects/scmbug/, and in particular bug 76 (http://bugzilla.mkgnu.net/show_bug.cgi?id=76#c33).
The issue of integration from an SCM system to ANY bug-tracker is solved by this project, including writing Windows hooks. You are already duplicating effort that does not belong to the codebase of a bug-tracker.
Please let's solve the "integration" problem once and for all http://www.public.asu.edu/~makrists/scmbug/latest_manual/html/c121.html#GOALS
comment:14 by , 20 years ago
The .bat and .com files given here did not work, so I fixed them (and cleaned them up a bit).
To make it clear what is going on I've created a new ticket (#1602) and attached the altered files there.
Hopefully that makes it easier to understand that the .bat files need to use the altered python hook scripts given in this ticket, while the .com files work with the standard python hook scripts available at branches/0.8-stable/contrib/
comment:15 by , 19 years ago
Milestone: | 0.9 |
---|---|
Priority: | high → low |
Resolution: | → duplicate |
Status: | new → closed |
Even though this is the original ticket, discussion should continue in #1602, and I'm marking this one as duplicate.
changed contrib/trac-post-commit-hook to support message in the file