[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: philvh <hovh03_at_yahoo.com>
Date: Tue, 7 Apr 2009 21:42:00 -0700 (PDT)

Here's my patch. 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)

-- 
View this message in context: http://www.nabble.com/-PATCH--change-svn-wc-format.py-tp22785459p22942960.html
Sent from the Subversion Dev mailing list archive at Nabble.com.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1589802
Received on 2009-04-08 06:51:15 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.