views:

49

answers:

2

In a repository for a well known open source project, all files contain a version string with a timestamp as their first line:

<?php  // $Id: index.php,v 1.201.2.10 2009-04-25 21:18:24 stronk7 Exp $

Even if I don't really understand why they do this - since the files are already under version control -, I have to live with this.

The main problem is that if I try to 'st' or 'diff' a release to get an idea of what was changed from the previous one, every single file contained in the repository is obviously marked as modified and the diffs become unreadable and unmanageable.

I'm wondering if there's a way to ignoring the first lines doing a diff/st when they match a regexp.

The project is under cvs - cvs, yes, you've read correctly - and included in a bigger mercurial repository.

A: 

If you try

man diff

you'll find

--ignore-matching-lines=RE Ignore changes whose lines all match RE.

search "ignore matching lines" on the web gives examples :

diff --unified --recursive --new-file --ignore-matching-lines='[$]Author.[$]' --ignore-matching-lines='[$]Date.[$]' ...

(http://www.cygwin.com/ml/cygwin-apps/2005-01/msg00000.html)

Thus try :

diff --ignore-matching-lines='[<][?]php  [/][/] [$]Id:'
Cedric
(You can also do a diff and then a grep -v "[<][?]php [/][/] [$]Id"... wwwwwwww :-P)
Cedric
Sorry, it was probably not clear in the question that I need to do that in a hg/cvs context. Using the UNIX diff probably won't help me :(
Roberto Aloi
Sure, but see the previous answer for how to set an external diff command - including the arguments presented in _this_ answer. Between the two answers you have a complete solution.
Steve Kemp
thanks for your comment Steve, it'll be some help for me as well :D
Cedric
+1  A: 

I don't know about cvs, but with hg you can use any external diff tool with the bundled extdiff extension, and any modern tool should have the ability to let you ignore diffs that match certain patterns.

I swear by Beyond Compare, which allows arbitrary syntax definition.

kdiff3 has preprocessor commands that you can pipe the input through.

Geoffrey Zheng