[RFC] fake editor for testing edit_commit_message

Jan Hudec bulb at ucw.cz
Thu Jan 5 08:52:14 GMT 2006


On Wed, Jan 04, 2006 at 17:24:59 -0600, John Arbash Meinel wrote:
> I think the problem is that it is trying to spawn a program named
> "python fed.py" not a program "python" feeding it the argument "fed.py".
> This is definitely a tricky thing to do on windows, since windows
> doesn't support having executable scripts (other than .bat files).
> I suppose you could do:
> 
> echo '@echo off' > test.bat
> echo 'python fed.py' >> test.bat
> And then use
> set BZR_EDITOR='test.bat'

Perl actually has executable scripts (with .bat extension), using this
preamble:

@rem = '--*-Perl-*--
@echo off
if "%OS%" == "Windows_NT" goto WinNT
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
:WinNT
perl -x -S %0 %*
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
goto endofperl
@rem ';
#!perl

@ character is meaningless for python, but it provides other workaround
-- the -x option.

It should be possible to simply put:

@python -x %0 %* & goto :EOF

at the start. It would only work on Windows NT/XP. For Windows 95/98/ME
it would have to be:

@python -x "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 & goto :EOF

(and I am not sure they would actually recognize the :EOF thing)

Actually, if someone could think of a way to prevent python from parsing
end of file somehow, we could have:

@goto endofpython

at the start and

:endofperl
<something like the perl preamble above>

-- 
						 Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060105/42123c3e/attachment.pgp 


More information about the bazaar mailing list