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

Re: [PATCH] change-svn-wc-format.py

From: Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA_at_GMail.Com>
Date: Thu, 9 Apr 2009 02:36:57 +0200

2009-04-08 06:42:00 philvh napisaƂ(a):
> Here's my patch.

Please create minimal patch against change-svn-wc-format.py from the python-3-compatibility branch:
https://svn.collab.net/repos/svn/branches/python-3-compatibility/tools/client-side/change-svn-wc-format.py

> The results run under Windows, Python 3.0.1
>
> @@ -19,6 +19,7 @@
> import sys
> import os
> import getopt
> +import stat
> try:
> my_getopt = getopt.gnu_getopt
> except AttributeError:
> @@ -89,7 +90,7 @@
> print("Parsing file '%s'" % entries.path)
> try:
> entries.parse(self.verbosity)
> - except UnrecognizedWCFormatException, e:
> + except UnrecognizedWCFormatException as e:
> if self.error_on_unrecognized:
> raise
> sys.stderr.write("%s, skipping\n" % e)
> @@ -109,7 +110,7 @@
> print("Checking whether WC format can be converted")
> try:
> entries.assert_valid_format(format_nbr, self.verbosity)
> - except LossyConversionException, e:
> + except LossyConversionException as e:
> # In --force mode, ignore complaints about lossy conversion.
> if self.force:
> print("WARNING: WC format conversion will be lossy. Dropping "\
> @@ -258,11 +259,11 @@
> assert len(str(format_nbr)) <= self.format_nbr_bytes
> format_string = '%0' + str(self.format_nbr_bytes) + 'd'
>
> - os.chmod(self.path, 0600)
> - output = open(self.path, "r+", 0)
> + os.chmod(self.path, stat.S_IWRITE) #0600)
> + output = open(self.path, "r+", 1)
> output.write(format_string % format_nbr)
> output.close()
> - os.chmod(self.path, 0400)
> + os.chmod(self.path, stat.S_IREAD)
>
> class Entry:
> "Describes an entry in a WC."
> @@ -320,14 +321,14 @@
> if os.path.exists(self.path):
> if verbosity >= 1:
> print("%s will be updated." % self.path)
> - os.chmod(self.path,0600)
> + os.chmod(self.path,stat.S_IWRITE)
> else:
> if verbosity >= 1:
> print("%s does not exist, creating it." % self.path)
> format = open(self.path, "w")
> format.write(format_string % format_nbr)
> format.close()
> - os.chmod(self.path, 0400)
> + os.chmod(self.path, stat.S_IREAD)
>
> class LocalException(Exception):
> """Root of local exception class hierarchy."""
> @@ -389,7 +390,7 @@
>
> try:
> converter.change_wc_format(new_format_nbr)
> - except LocalException, e:
> + except LocalException as e:
> if debug:
> raise
> sys.stderr.write("%s\n" % e)

-- 
Arfrever Frehtes Taifersar Arahesis

Received on 2009-04-09 02:37:07 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.