[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: Stefan Sperling <stsp_at_elego.de>
Date: Sun, 29 Mar 2009 10:37:29 +0100

On Sun, Mar 29, 2009 at 09:56:47AM +0800, E Wong wrote:
> > > + # Overwrite all bytes of the format number.
> > > + if os.path.exists(self.path):
> > > + format = open(self.path,"r")
> > > + os.chmod(self.path, 0600)
> > > + format_line = format.readline()
> > > + format_line.rstrip()
> > > + format_nbr_old = int(format_line)
> > > + format.close()
> > > + format = open(self.path, "w")
> > > + format.write(format_string % format_nbr)
> > > + if verbosity >= 2:
>
> Regarding this block, I noticed a slight 'uselessness' in that
> I get the old value and then I don't do anything to it. Would
> the comparison between the old and new number make any sense
> right now? If I simply write the new value(which has already
> been checked anyway) to the file, would that lessen the code?

Just write the new value. The user has asked for a conversion
to this format, and the entries file has already been converted.

Maybe we'll be writing the same value again (e.g. in a partially
converted working copy), but who cares.

>
> I was going to change the above to:
>
> format_line = format.readline().rstrip()
>
> or even more ambitious:
> format_nbr_old = int(format.readline().rstrip())
>
> but maybe that's a little too reckless?

You don't need this line if you stop reading the old value.

Stefan
Received on 2009-03-29 11:38:01 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.