How to make a dry-run with svn update

Quick Subversion trick:

I asked at the office today if anyone could figure out a method for doing a dry-run to see what files would be updated if you do an “svn update” from repository.

My colleague Mads came up with this:

jesper:test_project jesper$ svn merge –dry-run -r BASE:HEAD .
U app/helpers/application_helper.rb
U app/controllers/reports_controller.rb
A app/views/layouts/formula.html.erb
U app/views/overview/index.html.erb
U app/views/overview/_sidebar.html.erb
U app/views/reports/index.html.erb
A app/views/reports/_sidebar.html.erb
U app/views/reports/new.html.erb
U app/views/reports/start.html.erb
C log/development.log
U public/stylesheets/app.css

Brilliant! Now I can see which files will conflict or update before I pull newest version from repository. Now added as an alias:

alias svnupdry=’svn merge –dry-run -r BASE:HEAD .’

I took a brief look at the Git manual. There is apparently no flag on ‘git pull’ that does a dry-run. Anyone knows if the same thing is possible with Git?

Technorati Tags: , ,

12 Responses to “How to make a dry-run with svn update”

  1. Jesper Rønn-Jensen Says:

    Another nice one:

    alias svnupall=’for DIR in `find . -maxdepth 2 -type d -name “.svn” | cut -d / -f 2`; do echo “$DIR: “;svn update ./$DIR; done”

    This one updates all my svn projects in my code projects dir.
    From http://codesnippets.joyent.com/posts/show/368

  2. Rasterbator Says:

    Is that works? Anyway, i will copy down and have a try on it
    Thank you

  3. mehryar Says:

    svn status -u

    will also do a dry update run

  4. chebbers Says:

    “svn status -u” won’t show files that will become conflicted

  5. EmbeddedLinuxGuy Says:

    This doesn’t work perfectly for me on very old checkouts. I get false conflicts and “Skipping” messages, similar to symptoms in this forum post:

    http://translocator.ws/2005/10/12/svn-update-dry-run

    [jesse@sente]~/svn/rex> svn merge –dry-run -r BASE:HEAD .
    Skipped missing target: ‘www/html/HP/Traffic_Users_Guide.pdf’
    Skipped ‘www/html/js/traffic-class.js’
    C www/cgi-bin/queries
    [jesse@sente]~/svn/rex/www/cgi-bin>svn status queries
    [jesse@sente]~/svn/rex/www/cgi-bin>svn diff queries
    [jesse@sente]~/svn/rex/www/cgi-bin>svn status -u queries
    * 44231 queries

    See also

  6. Dan Says:

    thanks for your great post, Jesper! this is a very handy trick to know…will save me lots of time.

  7. Subversion update dry-run .. | itech9 Says:

    […] From http://justaddwater.dk/2008/04/29/how-to-make-a-dry-run-with-svn-update/ […]

  8. Weekly Digest for April 23rd – BorkWeb Says:

    […] Shared justaddwater.dk | How to make a dry-run with svn update. […]

  9. svn 指令 « 阿喵就像家 Says:

    […] http://justaddwater.dk/2008/04/29/how-to-make-a-dry-run-with-svn-update/ […]

  10. Markus Hedlund Says:

    That line didn’t work with SVN 1.6.16. Had to change it to:

    svn merge –dry-run –revision BASE:HEAD .

  11. Markus Hedlund Says:

    That should be

    svn merge –dry-run –revision BASE:HEAD .

    with two “-” before “dry-run” and “revision”.

  12. Jesper Rønn-Jensen Says:

    @Markus, yeah unfortunately wordpress tries to clever-change all quotes and double dashes.

    It is really really a wrong default and very annoying.

    BTW, you can avoid the double dashes by using the single letter equivalents “-n” for dry-run and “-r” for revision. But it then becomes less intuitive and a bit harder to learn:

    Then the expression becomes:

    svn merge –n –r BASE:HEAD .