[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Script or process to fix old invalid data in repositories or dumps?

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Sat, 5 Apr 2014 21:34:01 +0000

Mark Phippard wrote on Sat, Apr 05, 2014 at 10:58:59 -0400:
> On Sat, Apr 5, 2014 at 7:12 AM, Daniel Shahaf <d.s_at_daniel.shahaf.name>wrote:
>
> > Mark Phippard wrote on Fri, Apr 04, 2014 at 13:30:48 -0400:
> > > So I realize I can use that option to force the file to load, but that is
> > > just punting the problem to the future. Has anyone ever written any
> > > scripts that can run through an entire repository and fix these sort of
> > > problems? In this case, maybe a script that goes through a repos and
> > > retrieves and then sets each revprop using the current command line?
> >
> > That's easy enough:
> >
> > [[[
> > #!/usr/bin/env zsh
> > #
> > # Renormalize svn:* revprops in repository $1 (local path).
> > #
> > set -e
> > [ $# -eq 1 ] && [ -d "$1" ] || { echo "Usage: $0 REPOS" >&2; exit 1 }
> > REPOS=$1
> > ABS_REPOS=`cd -- "$REPOS" && pwd`
> > for revnum in {0..`svnlook youngest -- "$REPOS"`};
> > for prop in $(svnlook proplist -r$revnum --revprop -- "$REPOS" | cut
> > -c3- | grep '^svn:');
> > svnadmin setrevprop -r$revnum -- "$REPOS" "$prop" =(svn propget
> > --strict --revprop -r$revnum -- "$prop" "file://$ABS_REPOS")
> > ]]]
> >
>
> Thanks. I first ran svnsync and that worked and it said that it fixed 3
> revision properties.
>
> I then went back and ran your script on the source repository. This is
> what it output:
>
> svnlook: E135000: Inconsistent line ending style
> svnlook: E135000: Inconsistent line ending style
> svnlook: E135000: Inconsistent line ending style
>
> Do you think that means the script would have fixed those three properties,
> or did svnlook fail to list them because of the line endings?

Probably the latter. You could work around it by changing '$(svnlook
proplist ...)' to 'svn:log' and 'svn propget' to 'svnlook propget'
(which will create empty log messages on revisions that have no svn:log
property). It works for me on "foo\r\nbar\n"; if it fails on your data,
using the FS API directly (svn_fs_revision_proplist() and
svn_fs_revision_prop()) will definitely work, because the validation is
done in libsvn_repos.

Separately, I'm thinking we should call that a bug in svnlook. I mean,
yes, some property *values* break a semantic repos-layer invariant, but
it would still be nice to allow 'svnlook proplist' to succeed, and not
prevent querying of innocent bystander properties' names...

Daniel
Received on 2014-04-05 23:34:52 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.