You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Sergey A. Lipnevich" <se...@optimaltec.com> on 2009/04/12 03:52:19 UTC

[PATCH] Make svnperms.py work on Windows

Hi All,

Please accept the following patch for the svnperms.py hook script. The 
log message is below.
Thank you!

Sergey.


* tools/hook-scripts/svnperms.py
   Switch to subprocess module for running external commands, thereby
   improving Windows compatibility.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1661097

Re: [PATCH] Make svnperms.py work on Windows

Posted by "Sergey A. Lipnevich" <se...@optimaltec.com>.
Hi,

Any interest in this patch from the committers? If powers that be are 
willing to reinstate my commit privilege used as "recently" as 2003 
(user name "sergeyli"), I could commit it myself (and I promise not to 
touch anything else). Please?
Thanks in advance!

Sergey.

Sergey A. Lipnevich wrote:
> Hi All,
> 
> Please accept the following patch for the svnperms.py hook script. The 
> log message is below.
> Thank you!
> 
> Sergey.
> 
> 
> * tools/hook-scripts/svnperms.py
>    Switch to subprocess module for running external commands, thereby
>    improving Windows compatibility.
> 
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1661097
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1799026

Re: [PATCH] Make svnperms.py work on Windows

Posted by Gavin Baumanis <ga...@thespidernet.com>.
I have submitted this patch into the issue tracker : #3412

Gavin.


On 04/05/2009, at 1:00 AM, Sergey A. Lipnevich wrote:

> Gavin,
>
> Thanks for pointing this out! I hope somebody finds time to review  
> this.
> If these scripts require unit tests, I'm ready to write one.
> Thanks,
>
> Sergey.
>
> Gavin 'Beau' Baumanis wrote:
>> Ping. This Patch submission has received no comments.
>>
>> Gavin.
>>
>> On 12/04/2009, at 1:52 PM, Sergey A. Lipnevich wrote:
>>
>>> Hi All,
>>>
>>> Please accept the following patch for the svnperms.py hook script.  
>>> The
>>> log message is below.
>>> Thank you!
>>>
>>> Sergey.
>>>
>>>
>>> * tools/hook-scripts/svnperms.py
>>> Switch to subprocess module for running external commands, thereby
>>> improving Windows compatibility.
>>>
>>>
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2046493

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2168464

Re: [PATCH] Make svnperms.py work on Windows

Posted by "Sergey A. Lipnevich" <se...@optimaltec.com>.
Gavin,

Thanks for pointing this out! I hope somebody finds time to review this. 
If these scripts require unit tests, I'm ready to write one.
Thanks,

Sergey.

Gavin 'Beau' Baumanis wrote:
> Ping. This Patch submission has received no comments.
>
> Gavin.
>
> On 12/04/2009, at 1:52 PM, Sergey A. Lipnevich wrote:
>
>> Hi All,
>>
>> Please accept the following patch for the svnperms.py hook script. The
>> log message is below.
>> Thank you!
>>
>> Sergey.
>>
>>
>> * tools/hook-scripts/svnperms.py
>>  Switch to subprocess module for running external commands, thereby
>>  improving Windows compatibility.
>>
>>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2046493

Re: [PATCH] Make svnperms.py work on Windows

Posted by Gavin Baumanis <ga...@thespidernet.com>.
Ping. This Patch submission has received no comments.

Gavin.

On 12/04/2009, at 1:52 PM, Sergey A. Lipnevich wrote:

> Hi All,
>
> Please accept the following patch for the svnperms.py hook script. The
> log message is below.
> Thank you!
>
> Sergey.
>
>
> * tools/hook-scripts/svnperms.py
>  Switch to subprocess module for running external commands, thereby
>  improving Windows compatibility.
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1661097Index 
> : svnperms.py
> ===================================================================
> --- svnperms.py	(revision 37182)
> +++ svnperms.py	(working copy)
> @@ -6,15 +6,10 @@
> # $LastChangedBy$
> # $LastChangedRevision$
>
> +from subprocess import PIPE, Popen
> import sys, os
> import getopt
> try:
> -  # Python >=3.0
> -  from subprocess import getstatusoutput as  
> subprocess_getstatusoutput
> -except ImportError:
> -  # Python <3.0
> -  from commands import getstatusoutput as subprocess_getstatusoutput
> -try:
>    my_getopt = getopt.gnu_getopt
> except AttributeError:
>    my_getopt = getopt.getopt
> @@ -146,15 +141,18 @@
>        self.rev = rev
>
>    def _execcmd(self, *cmd, **kwargs):
> -        cmdstr = " ".join(cmd)
> -        status, output = subprocess_getstatusoutput(cmdstr)
> -        if status != 0:
> -            sys.stderr.write(cmdstr)
> -            sys.stderr.write("\n")
> -            sys.stderr.write(output)
> -            raise Error("command failed: %s\n%s" % (cmdstr, output))
> -        return status, output
> +        process = Popen(cmd, stdout = PIPE, stderr = PIPE)
> +        status = process.wait()
> +        if 0 == status:
> +            return status, process.stdout.read()
>
> +        cmdstr = ' '.join(cmd)
> +        error_output = process.stderr.read()
> +        sys.stderr.write(cmdstr)
> +        sys.stderr.write('\n')
> +        sys.stderr.write(error_output)
> +        raise Error("command failed: %s\n%s" % (cmdstr,  
> error_output))
> +
>    def _execsvnlook(self, cmd, *args, **kwargs):
>        execcmd_args = ["svnlook", cmd, self.repospath]
>        self._add_txnrev(execcmd_args, kwargs)

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1991587