Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a set of files that need a set of changes applied to them.

In this scenario I have a Java Application Server (distributed via a zip file) that I need to apply a set of known configurations to, and add some jar plugins to a specific folder. I don't want to simply create my own distribution that is pre-modified - I'd like to package only the changed files, and make those applicable to a pristine install.

What is the simplest tool to create such a changeset, and apply that same changeset on someone else's computer?

Ideally the tool could work without having to install anything on the users computer. The workflow would work like this:

  1. Download the original zip file containing the binary distribution of the application to be modified
  2. Unzip that application to any custom location. Maybe a folder under the root of the C drive, maybe the Desktop
  3. Download a file (and maybe the utility) that contains the set of changes
  4. Apply the set of changes to the directory

Some method that will work both in both an automated and manual way would be optimal.

I'd like not to have to set up some sort of server to host the patches. I am okay with installing a tool to be able to create them, as long as I don't have to install anything on the target machine to apply the patch.

I've considered simply creating a zip file with subdirectories. I am not sure what the easiest way to detect the differences and zip only the changes would be. I'd like a foolproof method that doesn't require a ton of manual steps (doing a diff and manually picking out the changes would be too error-prone).

Achieving minimal size is nice, but not required.

share|improve this question

2 Answers 2

The classic toolset is context diff and patch. See a ten minute guide to diff and patch

share|improve this answer
    
+1; I think I could combine this with a batch file to get the right p-level. I'll accept this once I implement it, if it wasn't too much of a pain. Side note: Off the top of your head, do you know any .Net and/or Java libraries to apply patches? –  Merlyn Morgan-Graham Oct 20 '11 at 10:08
1  
@MerlynMorgan-Graham: The top of my head didn't but my googly fingertips did: "The Diff Match and Patch libraries … Currently available in Java, JavaScript, C++, C#, Objective C, Lua and Python" –  RedGrittyBrick Oct 20 '11 at 10:18
up vote 0 down vote accepted

For my purposes, since the changes were small, it was simpler to create a zip file that contained replacement files than creating a patch. That way I didn't have to mess with p-levels.

To do this, I used Beyond Compare, selected the changed files, copied them out to an identically named directory (with a different parent path), and zipped up that identically named directory.

To apply it, I simply unzip it on top of the existing files, replacing all.

This won't detect whether or not the changes are valid to apply, unlike RedGrittyBrick's answer, which will detect this, but it is simpler to understand and works better for my scenario.

It also turned out I didn't have to automate the process. If you do, there are ways to run diff tools from a batch file, generating a file list to zip up, and using a command line zip utility to store the result.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.