You can replace the `command` syntax with the FOR syntax:
For example, to retrieve the author of a revision, you could use the
following syntax:
FOR /F "tokens=*" %%G IN ('%SVNLOOK% author -r %REV% %REPOS%') DO SET AUTHOR=%%G
Here is a working example:
@ECHO OFF
SET SVNLOOK=C:\PROGRA~1\Subversion\bin\svnlook
SET REV=122
SET REPOS="d:\project"
FOR /F "tokens=*" %%G IN ('%SVNLOOK% author -r %REV% %REPOS%') DO SET AUTHOR=%%G
ECHO "Author %AUTHOR%"
You can use the same syntax for other backquoted commands.
Important note: Thanks to the M$ shell script interpreter, this syntax
only works when executed from a .bat file. If you want to test it from
the command line, you need to replace the double %% with a single %
character.
HTH,
Manu
On 6/14/06, Emmanuel Blot <[EMAIL PROTECTED]> wrote:
> Hmm, I don't really use backquotes in my bat file but maybe that's the
> problem. Here is my bat file:
Yes, that's the very issue: you should use the backquote feature.
If you don't, the script simply cannot work.
The trouble is that Windows shell interpreter do not understand
backquotes, so using them won't change anything. No using them will
not produce the expected results
You can see by yourself:
SET AUTHOR=C:\PROGRA~1\Subversion\bin\svnlook.exe author -r %REV%
%REPOS%, as per the original script, is supposed to place the author's
name of %REV% in the AUTHOR variable.
Run this command, and print out the AUTHOR value:
echo %AUTHOR%
I don't have a script that runs under Windows. I'm kinda allergic to
Windows-as-a-server ;-) I can give you some hints about how to adapt
the script.
Cheers,
Manu
>
> SET REPOS=%1
> SET REV=%2
> SET LOG=C:\PROGRA~1\Subversion\bin\svnlook.exe log -r %REV% %REPOS%
> SET AUTHOR=C:\PROGRA~1\Subversion\bin\svnlook.exe author -r %REV% %REPOS%
> SET TRAC_ENV=C:\PROGRA~1\Subversion\trac.db
> SET TRAC_URL=http://130.226.235.30/cgi-bin/trac.cgi
>
> C:\Python23\python.exe C:\Python23\Scripts\trac-post-commit-hook.py -p
> %TRAC_ENV% -r %REV% -u %AUTHOR% -m %LOG% -s %TRAC_URL%
>
> Anyway, if you have a script that works fine on windows I would very much
> appreciate it!
>
>
> >From: "Emmanuel Blot" <[EMAIL PROTECTED]>
> >Reply-To: [email protected]
> >To: [email protected]
> >Subject: Re: [Trac] Problem with trac-post-commit-hook
> >Date: Wed, 14 Jun 2006 00:55:23 +0200
> >
> >>How do I set the log level to debug?
> >
> >See trac.ini in <project>/conf
> >
> >>C:\Cepa\Repositories\cepasoft\hooks>C:\Python23\python.exe
> >>C:\Python23\Scripts\t
> >>rac-post-commit-hook.py -p C:\PROGRA~1\Subversion\trac.db -r 7 -u
> >>C:\PROGRA~1\Su
> >>bversion\bin\svnlook.exe author -r 7 C:\Cepa\Repositories -m
> >>C:\PROGRA~1\Subvers
> >>ion\bin\svnlook.exe log -r 7 C:\Cepa\Repositories -s
> >>http://127.0.0.1/cgi-bin/trac.cgi
> >
> >Wait a minute, I just think this probably cannot work on Windows as-is!
> >
> >Windows shell interpreter does not understand the backquote syntax
> >(e.g. `svnlook author`), so you simply cannot use this syntax from a
> >.BAT or from the command line.
> >
> >There are three solutions (at least) to this issue. You either need to:
> >1. fix up the syntax to provide the "backquote feature" w/ Windows
> >2. use a "real" shell such as bash (Cygwin, ...) to invoke the Python
> >script
> >3. use a pure python based script to provide the information such as
> >the author without the Subversion command tool (svnlook ...)
> >
> >1. I consider it as a nightmare: writing .BAT files, but there is a
> >backquote equivalent syntax for Windows 2000/XP. I remember it is
> >based on the "FOR ..." command. You may want to find some info from
> >here: http://www.ss64.com/nt/for_cmd.html
> > To sum up, `command option` means that the output of "command" is
> >used in-place as an option for the trac-post-commit-hook.py script
> >2. This seems quite a heavy installation to run a simple script ;-)
> >3. You need to know Python to tweak the script
> >
> >3': I did get rid of the svnlook command in my own scripts (you can
> >retrieve the equivalent information through the Python SVN wrapper
> >instead of spawning a svnlook process). Please let me know if you are
> >interested in such scripts.
> >
> >Regards,
> >Manu
> >_______________________________________________
> >Trac mailing list
> >[email protected]
> >http://lists.edgewall.com/mailman/listinfo/trac
>
> _________________________________________________________________
> Log på MSN Messenger direkte på nettet: http://webmessenger.msn.com
>
> _______________________________________________
> Trac mailing list
> [email protected]
> http://lists.edgewall.com/mailman/listinfo/trac
>
--
Manu
--
Manu
_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac