On 2005-11-08 20:04:42 -0800, Garrett Rooney wrote:
> On 11/8/05, Madan U Sreenivasan <madan@collab.net> wrote:
>
> > Pl. find below a patch that makes this action portable to both windows
> > and unix. What however requires more comments is how to extract the path
> > of the python executable itself in the line...
> > + hook_script_code = ( "#!/usr/bin/env python\n"
> > How do I find the path to the python executable? Any ideas?
> > Pl. feel free to comment on the below patch...
> >
> > ------------------------8<----------------8<-------------------
> > Index: commit_tests.py
> > ===================================================================
> > --- commit_tests.py (revision 17264)
> > +++ commit_tests.py (working copy)
> > @@ -1970,11 +1970,16 @@
> >
> > # Setup the hook configs to echo data back
> > post_commit_hook = svntest.main.get_post_commit_hook_path (repo_dir)
> > + if sys.platform == 'win32':
> > + post_commit_hook = os.path.join (post_commit_hook, ".bat")
> > +
> > + hook_script_code = ( "#!/usr/bin/env python\n"
> > + "import sys\n"
> > + "\n"
> > + "sys.stderr.write('Nothing doing')\n"
> > + "sys.exit(-1)\n")
>
> I'm not a windows person, but I'm pretty sure you can't just stick
> python code into a .bat file on windows and expect it to do anything
> useful...
>
> You really need to write out an actual .bat script, I imagine there's
> some way to make a .bat write to the equivalent of stderr, but
> honestly I don't know what the syntax would be...
>
> -garrett
Hey,
Just wanted to chime in and say that at least for 2k and xp, Windows
supports sh-like syntax for redirecting output.
H:\>(echo hi) 1>NUL:
H:\>(echo hi 1>&2) 1>NUL:
hi
-Dominic
- application/pgp-signature attachment: stored
Received on Thu Nov 10 20:19:17 2005