Edgewall Software

Opened 9 years ago

Closed 7 years ago

#6370 closed defect (worksforme)

Contrib post-commit for Win has issues with quotes in project name, failing

Reported by: awbacker@… Owned by: Christian Boos
Priority: low Milestone:
Component: version control Version: devel
Severity: minor Keywords: trac-post-commit-hook multirepos
Release Notes:
API Changes:


The .cmd file used by the post-commit process for windows quotes both the revision number and trac environment. The revision # does not need to be quoted, but it is the quoting of the trac environment that causes a problem.

To see this you need to move the -r option before the -p. In the original order (script -p .. -r ...) the script complains about # of arguments. If you put the -r before the -P, you can see the issue described below:

The python script that is called from trac-post-commit-hook.cmd (trac-post-commit-hook) receives the argument complete with quotes, which it then tries to interpret as part of the project path. This leads to a command like:

trac-post-commit-hook -P "c:\trac-sites\funky" -r "107"

generating an error about not being able to find/read/etc the file

"IOError: [Errno 2] No such file or directory: 'e:\\trac-sites\\funky" \\VERSION'

I don't know where the first quote went, though. The fix to this, allowing for quotes in the trac site name, is to remove the quotes from the project name inside the post commit python script. Alternatly, if that is not possible, one could remove them from the ".cmd" file and require that the trac env path have no spaces.

I have also included a few comments in the post-commit hook, primarly to clarify for us new to this. The construct %~dp0 is unfamiliar to most, even those familar with dos batch files, but it is very useful.

Attachments (1)

fix-postcommit-quotes-in-tracenv-on-windows.patch (1.8 KB ) - added by awbacker@… 9 years ago.
Patch for post commit contrib files. Not sure about cr/lf issues with the py one

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by awbacker@…

Patch for post commit contrib files. Not sure about cr/lf issues with the py one

comment:1 Changed 9 years ago by awbacker@…

Actually, it would be nice to have a note in there that TRAC_ENV needs to not have the trailing slash. If you say -p c:\trac-sites\Krocsyldiphithic\ then a similar error will occur, and it will append a space to the name, leaving the path as:

c:\\trac-sites\\Krocsyldiphithic \\VERSION

comment:2 Changed 9 years ago by Christian Boos

Keywords: trac-post-commit-hook added
Milestone: 0.11.1
Version: devel

comment:3 Changed 8 years ago by Christian Boos

Keywords: multirepos added
Milestone: 0.11-retriage0.12

Take this into account when working on source:sandbox/multirepos/contrib/trac-svn-hook.cmd.

comment:4 Changed 8 years ago by Christian Boos

Milestone: 0.120.12-multirepos

comment:5 Changed 7 years ago by Christian Boos

Milestone: 0.12-multirepos0.12.1

The main hook source:sandbox/multirepos/contrib/trac-svn-hook works on Windows via cygwin, and that's enough for me… especially that I'm not that fluent in BAT programming.

Waiting for contributions.

comment:6 Changed 7 years ago by Christian Boos

Milestone: 0.12.1
Resolution: worksforme
Status: newclosed

Actually there is already a minimal script, source:sandbox/multirepos/contrib/trac-svn-post-commit-hook.cmd.

It uses trac-admin, which should already deal correctly with the quotes. If not, please reopen.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .

Note: See TracTickets for help on using tickets.