[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: Gavin Baumanis <gavinb_at_thespidernet.com>
Date: Thu, 30 Apr 2009 15:28:49 +1000

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
Received on 2009-04-30 07:29:20 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.