[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: Edmund Wong <edmund_at_belfordhk.com>
Date: Mon, 30 Mar 2009 09:41:59 +0800

Stefan Sperling wrote:
>> print("Processing directory '%s'" % dirname)
>> entries = Entries(os.path.join(dirname, get_adm_dir(), "entries"))
>> -
>> +
>
> You're adding whitespace above, not necessary.
>

That's been fixed.

>> + entries_parsed = True
>> if self.verbosity:
>> print("Parsing file '%s'" % entries.path)
>> try:
>> @@ -94,7 +95,17 @@
>> raise
>> sys.stderr.write("%s, skipping\n" % e)
>> sys.stderr.flush()
>> + entries_parsed = False
>>
>> + if not entries_parsed:
>
> I think you want
>
> if entries_parsed:

*sigh* Thanks for pointing that out.

>> +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 file will be updated." % self.path)
>
> Saying 'file' is redundant. We can just say:
>
> print("%s will be updated." % self.path)

Fixed.

>
>> + else:
>> + if verbosity >= 1:
>> + print("%s does not exist, creating it." % self.path)
>> + format = open(self.path, "w")
>
> Does this open() call work if the file has perms 0400 before we
> try to open it? Can you test what happens if the user has no
> write permission to the file (e.g. the file is owned by a
> different user)?

No. I should have placed the os.chmod(self.path, 0600)
in the section where the format file exists. That will
open the file permissions to 0600. Otherwise it won't work.

>
>> + os.chmod(self.path,0600)
>> + format.write(format_string % format_nbr)
>> + format.close()
>> + os.chmod(self.path, 0400)
>> +
>> class LocalException(Exception):
>> """Root of local exception class hierarchy."""
>> pass
>
> Otherwise it's great.
>
> Can you also provide a log message as described in
> http://subversion.tigris.org/hacking.html#patches ?

Will do.

I hope my attempts at patching this thing for so many
times didn't get on anyone's nerves.

Thanks for the patience, guys.

Edmund

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1476143
Received on 2009-03-30 14:19:29 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.