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

bulk rename in single transaction

From: Jay Berkenbilt <ejb_at_ql.org>
Date: 2004-12-29 19:14:46 CET

Executive summary: I'm looking for a way to do the equivalent of
multiple URL-based svn rename commands in a single transaction in much
the way you can do multiple URL-based svn mkdir commands in a single
transaction by running svn mkdir with multiple arguments. Options
considered include writing code using subversion APIs, doing lots of
co/update -Ns, or fabricating an incremental dump file and loading it.

------

As part of migrating a 9-year old 1 GB CVS repository to subversion, I
would like to do some bulk manipulation of a few thousand tags:
specifically, I'm renaming and rearranging the directories in the new
repository. (For example, rather than "tags/release-xml-base-1_6-rh9",
I want "releases/xml-base/rh9/1.6".)

For various reasons, I'd like to do this in a single transaction, and
I'm looking for options. If I had unlimited disk space, I could just
check out the "tags" directory and do all the changes locally with svn
rename, but this is obviously not an option! Were it not for the disk
space and checkout time issue, this would be a viable option as I have
the tools and expertise to do massive regular expression-based
renames.

I'm not afraid to write some code, so options that include writing
code using one of the subversion APIs are acceptable. If there's a
way to do it without writing code, I'd like to hear about that as
well.

One solution I've come up with is to use svn co -N liberally to check
out into a working copy the top-level directories of each tag. The
following does the job:

svn co -N file:///test/SVN
cd SVN
svn update -N tags
cd tags
files=(`svn ls file:///test/SVN/tags | sed -e 's,/$,,')
svn update -N $files

Then I can rename to my heart's content and do a big checkin at the
end.

The biggest drawback with this is that the svn update command above
took many hours to run. I'm looking for something a little more
efficient/elegant. If there were a way for me to specify a maximum
depth, I could an update in tags with a maximum depth of 1, or do a
checkout of tags with a maximum depth of 2. Hopefully that would run
much faster.

As far as coding options are concerned, not knowing the APIs, I see
two possible options:

 1. Write some code to do a checkout with a maximum depth if such a
    thing is possible using the APIs, then proceed with the local
    renames

 2. Do something else to do multiple renames in a single transaction
    without having a working copy. This is what I'm really looking
    for.

It's possible, for example, to do multiple URL-based mkdir commands in
a single transaction, but not to do multiple URL-based rename commands
in a single transaction.

What would be ideal would be to able to put all the renames in a file
and run something to generate a single transaction that would perform
all of those operations.

I'm not above fabricating an incremental dump and restoring from it
either. This looks like it would be quite doable for this case. Of
course, I would do a backup before doing this. :-)

Other ideas? Suggestions on how to proceed? Any help would be
appreciated.

-- 
Jay Berkenbilt <ejb@ql.org>
http://www.ql.org/q/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Dec 29 19:17:33 2004

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.