I was moving some directories around in $DAYJOB's svn repository and I wasted a lot of time doing it. The problem was that I didn't realize that svn mv requires that both source and destination parent directories need to be committed at the same time.
I needed backward compatibility, so what I was doing was similar to:
svn mv {parentdir/srcdir} {elsewhere/destdir}
svn commit {parentdir} -m "some message"
ln -s {elsewhere/destdir} {parentdir/srcdir}
svn add {parentdir/srcdir}
svn commit {parentdir/srcdir} -m "some message"
svn commit {elsewhere/destdir}
usually I'd do that for a few directories before bunching the
commits of elsewhere.
I was then getting svn errors because the source wasn't around anymore. When
doing svn mv, it's necessary to commit the A (in the destination directory) and
the D (in the source directory) in the same commit, otherwise there will be
a lot of backfilling and rework necessary. What I had to do was find the
revision at which the given directories were deleted from the parentdir,
svn cp -r [rev] [URL] [destdir]
them (specifying a revision one less than the one they were deleted in), and
commit, bringing them back. Then I'm doing the svn mv operation again, but
this time committing both at the same time and only doing the "ln -s" at the end,
and in its own commit (can't be done along with the svn mv because I want the
link to have the same name as the source file, but the source file hasn't been
deleted yet, the ln -s and svn add of the link needs to be done after the
source file D operation has already been committed.
The links (for backward compatibility) are making a regular svn update fail.
This is because svn update needs to create the link, but the original file
is still there. svn doesn't replay the commit history, so it doesn't have
the opportunity to delete directory entries which are no longer the same type
(formerly directories, now links). I was going to just check out the whole
tree, but I think I'll wait on that, instead I'll first just remove all links
(find . -type l | xargs rm -f) and then svn update since the only same-name
files in there are links inserted for backward compatibility.
No comments:
Post a Comment