On Sat, Mar 28, 2009 at 11:46:32AM +0800, Edmund Wong wrote:
> On Fri, 27 Mar 2009 14:36:52 +0000, Stefan Sperling wrote
> > On Fri, Mar 27, 2009 at 12:52:04PM +0800, Edmund Wong wrote:
> > > Here's the patch to create the format file in the WC .svn folder.
> >
> > It does not look like you used 'svn diff' to produce this patch.
> >
> My mistake. I used TortoiseSVN's diff feature. Anyway, I'll post
> a new diff with the changes.
Yes, please post a new diff.
> > The above change is probably due to mismatching end-of-line markers?
> > Does that also happen with 'svn diff'?
> >
> Nope. As mentioned above, my bad.
>
> > Please use spaces after commas for consistency:
> > > +
> > > +
> >
> > Adding the two empty lines above might not be necessary.
> > The rest of the code also uses spaces around operators like +.
> >
>
> I've fixed the space issues.
>
> > > + # Overwrite all bytes of the format number.
> > > + if os.path.exists(self.path):
> > > + format = open(self.path,"r")
> > > + os.chmod(self.path, 0600)
> >
> > Will the chmod work on Windows?
> >
>
> Nope. It doesn't work, or rather, it has no affect,
> as far as I know. (Ran this script on a Vista machine.)
>
> Should I test for OS?
If os.chmod() is a no-op on OSs the don't support chmod,
we don't need extra code to check for OS.
Let python handle it if it can.
> > > + format_line = format.readline()
> > > + format_line.rstrip()
> > > + format_nbr_old = int(format_line)
> > > + if format_nbr_old < format_nbr:
> > > + # Upgrading version is not supported? (Please review.)
> > > + raise UnrecognizedWCFormatException(format_nbr_old,self.path)
> >
> > Changing working copy format should work either way, up to 1.6.
> > This script will never be able to support 1.7.
> >
> I understand. So basically I take out the last three lines above?
You need to create the file with the correct format version
number no matter which direction you are going.
For all x and y in [0...6] inclusive:
Downgrade from svn 1.x to svn 1.y -> decrease format number appropriately.
Upgrade from svn 1.x to svn 1.y -> increase format number appropriately.
> > Note that not all versions of Subversion actually read and interpret
> > the format file. I'm not sure when we stopped reading it, but the
> > revision log of subversion/libsvn_wc/log.c might tell you.
>
> From Greg Stein's post, it's likely that it's only up to 1.4.
> Or did I misunderstand?
Greg is usually right ;)
You can decide whether to treat Subversion 1.4 and above as
a special case and leave the file empty, or if you don't want
special cases and just always create an appropriate format file.
Either approach will fix the bug with 1.6.0.
> > > + if verbosity >= 2:
> > > + print("Downgraded WC format.")
> >
> > This message sounds like the whole operation of downgrading
> > the working copy was complete. Is this appropriate here?
>
> I fixed it to "format file has been updated." Is this a better
> message?
Yes.
Thanks,
Stefan
Received on 2009-03-28 13:53:11 CET