{"id":331,"date":"2007-10-19T19:27:10","date_gmt":"2007-10-19T09:27:10","guid":{"rendered":"http:\/\/www.erisian.com.au\/wordpress\/?p=331"},"modified":"2007-10-19T19:27:10","modified_gmt":"2007-10-19T09:27:10","slug":"multiple-repositories-sumultaneously","status":"publish","type":"post","link":"https:\/\/www.erisian.com.au\/wordpress\/2007\/10\/19\/multiple-repositories-sumultaneously","title":{"rendered":"Multiple Repositories &#8212; Sumultaneously!"},"content":{"rendered":"<p>If, like me, you&#8217;ve been following development of Joey&#8217;s nifty new <a href=\"http:\/\/kitenet.net\/~joey\/code\/mr\/\">multi-repository tool<\/a> and busily registering all your git and bzr and cvs and whatnot repos, you might have noticed a tantalising TODO item that&#8217;s recently appeared in the git repo:<\/p>\n<blockquote>\n<pre>\n* Ability to run commands in paralell? (-j n)\n\n  If done right, this could make an update of a lot of repos faster. If\n  done wrong, it could suck mightily. ;-)\n<\/pre>\n<\/blockquote>\n<p>Well, sucking mightily just means you need to prototype it first, so here&#8217;s a little add-on to mr(1) that runs multiple invocations of mr(1) simultaneously, naturally enough called <a href=\"http:\/\/azure.humbug.org.au\/~aj\/mrs-0.4\">mrs(1)<\/a>. Consideration of what that implies about superior multitasking is left as an exercise to the interested reader.<\/p>\n<p>The implementation is slightly interesting: it&#8217;s a fairly simple perl script that first uses &#8220;mr list&#8221; to get a list of repositories to work with, then simply uses perl&#8217;s &#8220;open&#8221; function to run mr on each of those directories with the output piped to a filehandle. At that point, things get slightly complicated, since we want to keep them all running no matter what&#8217;s going on, so we have a select() loop that collects all the output into one buffer per command, which we put together later, and print out. And just for kicks, if the output &#8216;s longer than 20 lines, we pipe it through less after trimming out any ugly ^M nonsense we might have had thanks to progress updates or similar.<\/p>\n<p>I like it, anyway. And happily, while &#8220;mr update&#8221; takes about fifty seconds for me, &#8220;mrs update&#8221; takes about ten. Fun!<\/p>\n<p>(Joey: btw, it&#8217;s &#8220;parallel&#8221; :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If, like me, you&#8217;ve been following development of Joey&#8217;s nifty new multi-repository tool and busily registering all your git and bzr and cvs and whatnot repos, you might have noticed a tantalising TODO item that&#8217;s recently appeared in the git repo: * Ability to run commands in paralell? (-j n) If done right, this could [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/www.erisian.com.au\/wordpress\/wp-json\/wp\/v2\/posts\/331"}],"collection":[{"href":"https:\/\/www.erisian.com.au\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.erisian.com.au\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.erisian.com.au\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.erisian.com.au\/wordpress\/wp-json\/wp\/v2\/comments?post=331"}],"version-history":[{"count":0,"href":"https:\/\/www.erisian.com.au\/wordpress\/wp-json\/wp\/v2\/posts\/331\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.erisian.com.au\/wordpress\/wp-json\/wp\/v2\/media?parent=331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.erisian.com.au\/wordpress\/wp-json\/wp\/v2\/categories?post=331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.erisian.com.au\/wordpress\/wp-json\/wp\/v2\/tags?post=331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}