Created
May 12, 2011 13:42
-
-
Save PowerKiKi/968513 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
=begin | |
If you have subversion repository with many externals, it may take a bit too long to update it, as updates happen one after another. | |
This bit of script updates each external in parallel, making it oh so much faster. | |
(note: if you add an external or change an external property in another way, you'll need to run the standard svn up once) | |
Last seen on http://codesnippets.joyent.com/posts/show/548 | |
=end | |
puts( | |
( `svn pl -R`.scan(/\S.*'(.*)':\n((?: .*\n)+)/)\ | |
.inject({}) { |h, (d, p)| h[d] = p.strip.split(/\s+/); h }\ | |
.select { |d, ps| ps.include? 'svn:externals' }\ | |
.map { |xd, ps| [xd, `svn pg svn:externals #{xd}|grep -v ^#`] }\ | |
.map { |xd, exts| exts.strip.split(/\s*\n/).map { |l| xd + '/' + l.split(/\s+/).first } }\ | |
.inject { |a, b| a + b }\ | |
.map { |d| "cd #{d} && svn up 2>&1" } \ | |
<< 'svn up . --ignore-externals 2>&1' | |
)\ | |
.map { |cmd| [cmd, Thread.new { `#{cmd}` }] }\ | |
.map { |cmd, thread| "#{cmd}\n#{thread.value}" }.join("\n") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment