tags:

views:

36

answers:

1

I want to generate a summary of the files that are in one tree that are also in the other, that have been modified in the second.

The use case is this: I have a product distribution, which contains web content files. Those files are then imported into a client-specific project, and may be modified from there. I now want to see all the files in the client-specific project that have changed since the prduct was imported, so I can update the product, and keep the client-specific changes.

I'm thinking something like this might work

diff -r productDistribution/WebContent clientProject/WebContent

However, there are a number of files that are in the client specific project that are not in the product distribution, that I am not concerned with in this process. Essentially, I want an 'outer join', in SQL parlance.

Ideally, I want to be able to create a patch that contains all the client-specific changes. Then, I can just overlay the new product files, and apply the patch, and I should be all set.

Any ideas?

+1  A: 

By default diff only prints a single line for each file that is in only one of the trees, so it's easy to filter these out:

diff -r productDistribution/WebContent clientProject/WebContent | \
    grep -v 'Only in clientProject'
Nathan Kitchen
I though of that. I was hoping there was a way to do it without this post-processing, but if not, then that answers my question.
pkaeding
I don't think the post-processing is avoidable. At least the man page for diff that I'm looking at doesn't include an option to ignore files without a counterpart.
Nathan Kitchen