B/W Rainbow

September 20, 2008

SVN: Export only updated files between 2 revisions

 

Are you someone like me who is looking for an SVN command that exports the files updated between two revisions? Until now, I used to say that there is no such command available in SVN by default, or maybe now they have a feature to build in the next release.

Don’t lose hope. After having a hard time searching for an out of the box solution, I built my own with power of PHP 😉 what else?

The scenario

  • Working with a team that uses SVN for versioning.
  • Your production server doesn’t have svn, so you can’t run the command svn update. Even if you have svn in your production server and your stupid system admin denied to open svn port of your dev server over firewall for security reasons(Believe me, it happens I wrote more than 10 email to my system admin, and I can’t make him understand why we need this port to be open.
  • You need to upload the changes frequently and you have a very large list of directories which need to be chmod to 777 if you prefer uploading all again or,  you don’t keep the files uploaded to the server in Dev (e.g. user images, videos are uploaded in the server are not required in Dev)
  • All you need is to upload the files which are updated after the previous build. It is not so easy if you have too many directories of hierarchy (or using a PHP Framework like me. i.e., controller, models, views, app etc.,) 

Prerequisites

  • What does svn log do?
    It’s a command svn to list the files updated and other information in a revision or between two revisions, when you run the command “svn log -rM:N -v” (M,N are two revision numbers) in your working copy directory. You need the output of this command to provide the input for the script.
  • A working copy. (HEAD checkout from your Repo)
  • A directory with “chmod 0777″ for the script to copy only the updated files for upload. 

 

The Script

  • You can download the source here.
  • View source here.
  • Try the demo

Screenshots

Advertisements

7 Comments »

  1. does this script handle deleted files between revisions?

    Comment by Omer Hasan — December 17, 2008 @ 1:24 am | Reply

    • Hi Omer,

      The script will list the files deleted between two versions but it won’t delete the same for you. It will the directory hierarchy and place the files(Recent version if it is modified more than once) in appr. path. The script is used to upload only the updated files between two revisions to the server instead of uploading all. I’ll update the post with the screenshot.

      Comment by Palani raja — December 17, 2008 @ 4:03 pm | Reply

  2. Update:

    Screenshot added

    Comment by Palani raja — December 18, 2008 @ 10:59 am | Reply

  3. Thanks for the post. Unfortunately, neither the download source nor the view source links works. Got a 404 error. Can you look into it?

    Comment by Rams — December 26, 2008 @ 5:01 pm | Reply

  4. The links for demo and view source has been fixed. Since the source is hosted in googlecode you should be able to get it at any point of time.

    Comment by Palani raja — December 27, 2008 @ 2:13 am | Reply

  5. Thanks for updating the links. I works now. I don’t know PHP but reading the code I gather that you get a list of modifications and copy files from the working copy to a folder ignoding the deletes. Is this correct? If so are you not always copying the HEAD version of the file to the destination and not the state of the file at version number 100 (say). What do you think?

    Comment by Rams — January 15, 2009 @ 7:21 pm | Reply

  6. Hi Palani raja,

    you have done a great job, but i think tortoise SVN client has this inbuilt feature.
    please check out this link.

    http://www.verysimple.com/blog/2007/09/06/using-tortoisesvn-to-export-only-newmodified-files/

    Comment by Ravi Gulhane — March 13, 2009 @ 7:27 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: