Change name of folder in subversion *without* a checkout

9

So, there is a folder in a subversion repository which is incorrectly named. I have been tasked with renaming it. Unfortunately, the repository is very large which means it takes quite a bit of time to try to check things out. It's also continually giving me "connection reset by peer" messages.

Is there a way to simply send the commit instruction to the repository without a checkout? I don't need to have a working checkout locally.

(If it is relevant, the repository is hosted in Assembla)

cwallenpoole

Posted 2014-11-03T16:18:54.937

Reputation: 742

Answers

10

First, for your direct question: svn move allows giving URLs in a repository, to avoid the need for a working copy for this one operation. For example,

svn mv http://example.com/svn/repo/trunk/path/to/dir http://example.com/svn/repo/trunk/path/to/renameddir -m "renaming poorly named directory"

But really, repository size should have basically no impact on this task. You DON'T need to check out a full repository for this task. Probably you don't need to check out the full repository for MOST tasks, really, so you should read on! A concept called a sparse working copy allows you to check out only what you need for your task. Additionally, always only checkout the subtree you need from the repository.

For your immediate task, you can create a working copy containing only the folders in the directory immediately above the one that needs a rename. To continue the example, you would get this working copy like this:

svn co --depth immediates http://example.com/svn/repo/trunk/path/to MY_WORKING_COPY

Note, this will also pull in any files in the "to" directory outside of subdirectories, if there are any. If you want to avoid those, that's also possible:

svn co --depth empty http://example.com/svn/repo/trunk/path/to MY_WORKING_COPY
svn up --set-depth empty MY_WORKING_COPY/dir

Note, the TortoiseSVN client allows easy automation of the second method, if you need a bunch of files/subdirectories.

Search the web for "sparse working copy" and you'll find plenty more info.

Ben

Posted 2014-11-03T16:18:54.937

Reputation: 2 050