1

I have over 250 SVN projects I need to checkout from my server, and I was wondering if there was a way I could automate the process. All the projects are in the same file:

data/
..project1
..project2
..project3

etc

Is there a command I could do in the command line to automate the process? Doing it manually 250+ times would be a serious pain.

Thanks!

user1178343
  • 13
  • 1
  • 3
  • 1
    I presume by _'projects'_ you mean _repositories_? I guess this is just one reason why it is recommended to create a single root repo and add sub-repos to that. – Grant Thomas Jan 30 '12 at 15:15
  • I agree with the above comment. If they're just projects under the same repository, then you just checkout the repository root. If they're different repositories, I think you'll need to write a script. – qxn Jan 30 '12 at 15:23

2 Answers2

2

Short of defining 1 'meta'-repo, with all projects defined as external, I can't think of a pure-svn solution.

Depending on your access to the server other methods could be employed, for instance with ssh:

 for repo in `ssh user@host 'ls /var/svn-repos'`;do svn co <method of connecting/path>/$repo $repo;done;

In short: you need a non-svn method to list all repos.

Wrikken
  • 69,272
  • 8
  • 97
  • 136
1

You'll have to learn to use the command line client. It's bundled with TortoiseSVN yet you need to make sure it gets installed because the installer offers it as optional component.

C:>svn help checkout
checkout (co): Check out a working copy from a repository.
usage: checkout URL[@REV]... [PATH]

If specified, REV determines in which revision the URL is first
looked up.

If PATH is omitted, the basename of the URL will be used as
the destination. If multiple URLs are given each will be checked
out into a sub-directory of PATH, with the name of the sub-directory
being the basename of the URL.

In short, you'll have to use your favourite text editor to compose lines like this:

svn checkout https://example.com/path/to/repos/project1 ^
svn checkout https://example.com/path/to/repos/project2 ^
svn checkout https://example.com/path/to/repos/project3 ^
...
svn checkout https://example.com/path/to/repos/project250 ^
c:\path\to\working-copies

... and then either save as *.bat file or copy and paste into a command line prompt. (The ^ symbol is just a trick to allow multi-line commands; you can also write everything into a single line.)

Personal thought: it's hard to believe there's a pointy-haired boss out there that expects you to work on 250 different projects. Most likely, you have 250 customizations of the same product and having 250 repositories is the consequence of some bad decision in the past. Whatever, good luck.

Update: It's very possible that Windows command prompt has a maximum allowed command size. If you want to stay of the safe side, write 250 different svn checkout lines instead.

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
  • 1
    _'On computers running Microsoft Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters. On computers running Microsoft Windows 2000 or Windows NT 4.0, the maximum length of the string that you can use at the command prompt is 2047 characters.'_ http://support.microsoft.com/kb/830473 – Grant Thomas Jan 30 '12 at 15:37
  • svn checkout url1 url2 url3 etc.. worked! I only had to output a list of all the urls to get it working. Thank you very much! – user1178343 Jan 30 '12 at 18:58
  • 1
    Having 250 separate commands is preferred, as you can easily REM some of them out, have error checking/handling, etc.. – Chris Thornton Jan 31 '12 at 15:06