问题
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!
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/9066079/how-can-i-checkout-multiple-svn-repositories-in-one-command