Edgewall Software
Modify

Ticket #6370 (closed defect: worksforme)

Opened 4 years ago

Last modified 2 years ago

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

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

Description

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

fix-postcommit-quotes-in-tracenv-on-windows.patch (1.8 KB) - added by awbacker@… 4 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

Changed 4 years ago by awbacker@…

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

comment:1 Changed 4 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 4 years ago by cboos

  • Keywords trac-post-commit-hook added
  • Milestone set to 0.11.1
  • Version set to devel

comment:3 Changed 3 years ago by cboos

  • Keywords multirepos added
  • Milestone changed from 0.11-retriage to 0.12

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

comment:4 Changed 2 years ago by cboos

  • Milestone changed from 0.12 to 0.12-multirepos

comment:5 Changed 2 years ago by cboos

  • Milestone changed from 0.12-multirepos to 0.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 2 years ago by cboos

  • Milestone 0.12.1 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

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.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.