Easily Zip Changed Files in Your Subversion Working Copy

Subversion is a great tool for source control on a team of software developers. Every check-in we do into subversion must be accompanied by a code review from a fellow developer. The best method for doing this is to send the modified files to another developer in zip format. But how does one do this with a large source tree?

*nix

From the command line run the following:

svn status | grep ^[AM] | awk '{print $2}' | zip ~/Desktop/cr -@

A small explanation of what's going on here:

I have actually saved this to a bash script to make sure I delete any existing cr.zip.

Windows

Heaven forbid you can actually do something more easily and nearly as geeky on Windows but it's true....

This assumes you use TortoiseSVN which is a stellar program that integrates into the Windows shell.

Right-click on your trunk directory and choose TortoiseSVN => SVN Check for Modifications. This command sends svn status and returns the list to a dialog box. From here you can double-click each file for easy diff.

To zip these files up create a new zip file (on your desktop) with your zip utility of choice (aka WinRar or WinZip - as you'll see in a moment) and open the zip in your utility.

From the TortoiseSVN window select all the files you want to zip (you will have to manually unselect (or not select) deleted, missing, or non-added files which is made easier if you sort by the "text status" column) and drag them to the title bar of your zip utility. With WinRar and WinZip you get a dialog giving you options about how you want to add these files - make sure you select to add the files with full paths or when they are unzipped they'll be all at the root of the zip file.

I have not played with other zip utilities on windows outside of 7z which does give you the option to add files by full path.


Comments (2)

That is exactly what I needed.  Thanks for posting this.

Cheers,

Matthew

Posted over 3 years ago

Great, I wanted this and was thinking about writing a batch file to zip files one by one by getting the path. This helped a lot. Thanks.

Posted about 3 years ago

Comment: