{"id":1256,"date":"2008-11-22T11:27:05","date_gmt":"2008-11-22T11:27:05","guid":{"rendered":"http:\/\/coalface.mcslp.com\/?p=182"},"modified":"2008-11-22T11:27:05","modified_gmt":"2008-11-22T11:27:05","slug":"multiple-vcs-updates-and-cleanups","status":"publish","type":"post","link":"https:\/\/planet.mcb.guru\/?p=1256","title":{"rendered":"Multiple VCS Updates and Cleanups"},"content":{"rendered":"<p>I spend a lot of time updating a variety of different repositories of different varieties and denominations, and I hate having to do that all by hand &#8211; I&#8217;d rather just go up into a top-level directory and say <code>update-all<\/code> and let a script work out what to do, no matter what different repos are there. <\/p>\n<p>I do it with a function defined within my bash profile\/rc scripts, and it covers git, bzr, svn, bk, and cvs. The trick is to identify what type of directory we are updating. I do this, lazily, for each type individually, rather than for each directory, but I&#8217;ve found this method to be more reliable.<\/p>\n<blockquote>\n<p><code>update-all ()<br \/>\n{<br \/>\n    for file in `ls -d *\/.svn 2>\/dev\/null`;<br \/>\n    do<br \/>\n        realdir=`echo $file|cut -d\/ -f1`;<br \/>\n        echo Updating in $realdir;<br \/>\n        ( cd $realdir;<br \/>\n        svn update );<br \/>\n    done;<br \/>\n    for file in `ls -d *\/.bzr 2>\/dev\/null`;<br \/>\n    do<br \/>\n        realdir=`echo $file|cut -d\/ -f1`;<br \/>\n        echo Updating in $realdir;<br \/>\n        ( cd $realdir;<br \/>\n        bzr pull );<br \/>\n    done;<br \/>\n    for file in `ls -d *\/.git 2>\/dev\/null`;<br \/>\n    do<br \/>\n        realdir=`echo $file|cut -d\/ -f1`;<br \/>\n        echo Updating in $realdir;<br \/>\n        ( cd $realdir;<br \/>\n        git pull );<br \/>\n    done;<br \/>\n    for file in `ls -d *\/CVS 2>\/dev\/null`;<br \/>\n    do<br \/>\n        realdir=`echo $file|cut -d\/ -f1`;<br \/>\n        echo Updating in $realdir;<br \/>\n        ( cd $realdir;<br \/>\n        cvs up );<br \/>\n    done;<br \/>\n    for file in `ls -d *\/BitKeeper 2>\/dev\/null`;<br \/>\n    do<br \/>\n        realdir=`echo $file|cut -d\/ -f1`;<br \/>\n        echo Updating in $realdir;<br \/>\n        ( cd $realdir;<br \/>\n        bk pull );<br \/>\n    done;<br \/>\n    unset realdir<br \/>\n}<br \/>\n<\/code><\/p>\n<\/blockquote>\n<p>That&#8217;s it &#8211; a quick way to update any directory of repos.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I spend a lot of time updating a variety of different repositories of different varieties and denominations, and I hate having to do that all by hand &#8211; I&#8217;d rather just go up into a top-level directory and say update-all and let a script work out what to do, no matter what different repos are [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[36],"_links":{"self":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/posts\/1256"}],"collection":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1256"}],"version-history":[{"count":0,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/posts\/1256\/revisions"}],"wp:attachment":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}