Here's final patch. I appreciate your patience, guys.
(I hope the log is ok. I believe it is a follow up to
r36302, as per the thread "format file in working copies").
Log as follows:
[[[
Followup to r36302.
Modified change-svn-wc-format.py to create or update
format file in the .svn folder.
* tools/client-side/change-svn-wc-format.py
(WCFormatConverter: write_dir_format): Added a check
if the entries file was parsed properly. If so,
the format file is also created (if it does not
exist in the .svn folder) or updated with the
given format_nbr value as given by the
write_dir_format parameter.
(class Format): Added new class to take
care of the .svn/format file.
Patch by: Edmund Wong <edmund_at_belfordhk.com>
Reviewed by: stsp <stsp_at_elego.de>
arfrever <arfrever_at_gentoo.org>
Daniel Shahaf <d.s_at_daniel.shahaf.name>
]]]
Index: change-svn-wc-format.py
===================================================================
--- change-svn-wc-format.py (revision 36847)
+++ change-svn-wc-format.py (working copy)
@@ -84,7 +84,7 @@
if self.verbosity:
print("Processing directory '%s'" % dirname)
entries = Entries(os.path.join(dirname, get_adm_dir(), "entries"))
-
+ entries_parsed = True
if self.verbosity:
print("Parsing file '%s'" % entries.path)
try:
@@ -94,7 +94,17 @@
raise
sys.stderr.write("%s, skipping\n" % e)
sys.stderr.flush()
+ entries_parsed = False
+ if entries_parsed:
+ format = Format(os.path.join(dirname, get_adm_dir(), "format"))
+ if self.verbosity:
+ print("Updating file '%s'" % format.path)
+ format.write_format(format_nbr, self.verbosity)
+ else:
+ if self.verbosity:
+ print("Skipping file '%s'" % format.path)
+
if self.verbosity:
print("Checking whether WC format can be converted")
try:
@@ -298,7 +308,26 @@
rep += "[%s] %s\n" % (Entries.entry_fields[i], self.fields[i])
return rep
+class Format:
+ """Represents a .svn/format file."""
+ def __init__(self, path):
+ self.path = path
+
+ def write_format(self, format_nbr, verbosity=0):
+ format_string = '%d\n'
+ if os.path.exists(self.path):
+ if verbosity >= 1:
+ print("%s will be updated." % self.path)
+ os.chmod(self.path,0600)
+ 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)
+
class LocalException(Exception):
"""Root of local exception class hierarchy."""
pass
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1476774
Received on 2009-03-30 14:19:59 CEST