threads / discuss / 43426

Re: Diffs from CVS keyword expansion

Subject: Re: Diffs from CVS keyword expansion

## tl;dr

11 messages between Dec 1, 2006 and Dec 6, 2006.

replies: 10people: 8as markdown or json

Jon Smirl· Dec 1, 2006, 03:56 UTC · lore

Diffs from CVS keyword expansion

Anyone have a nice script for suppressing diffs caused by CVS keyword expansion when someone checked the kernel sources into CVS?

I have 200,000 lines of various forms of this mixed in with real changes

It is unclear who checked it into CVS, Microcross or Arch Linux. If it is Arch Linux finding the source for their 2.6.11.4-1 release would help a lot. I looked on their web site and couldn't locate it.

I'm starting understand why the support for MX21 on a CSB535FS has never been added to the mainline.

diff --git a/drivers/char/ftape/lowlevel/ftape-ctl.c
b/drivers/char/ftape/lowlevel/ftape-ctl.c
index 32e0439..ff10633 100644
--- a/drivers/char/ftape/lowlevel/ftape-ctl.c
+++ b/drivers/char/ftape/lowlevel/ftape-ctl.c
@@ -17,9 +17,9 @@
  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

  *
- * $Source: /homes/cvs/ftape-stacked/ftape/lowlevel/ftape-ctl.c,v $
- * $Revision: 1.4 $
- * $Date: 1997/11/11 14:37:44 $
+ * $Source: /home/arch-linux/{cvs}/linux--dev--2.6/drivers/char/ftape/lowlevel/ftape-ctl.c,v
$
+ * $Revision: 1.1.1.1 $
+ * $Date: 2005/03/24 06:16:39 $
  *
  *      This file contains the non-read/write ftape functions for the
  *      QIC-40/80/3010/3020 floppy-tape driver "ftape" for Linux.
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c
b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 63c8168..54d9a10 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -29,7 +29,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  *
- * $Id: ipoib_main.c 1377 2004-12-23 19:57:12Z roland $
+ * $Id: ipoib_main.c,v 1.1.1.1 2005/03/24 06:16:41 arch-linux Exp $
  */

 #include "ipoib.h"
-- 
Jon Smirl
Juergen Ruehle· Dec 1, 2006, 07:06 UTC · re: Jon Smirl · lore
Jon Smirl writes:
 > Anyone have a nice script for suppressing diffs caused by CVS keyword
 > expansion when someone checked the kernel sources into CVS?
I usually just say (with GNU diff)
  diff -I $$ ...

which is crude, but should be enough to get rid of the hunks listed by you.

You might also want -x CVS if you have the metadata files.
Linus Torvalds· Dec 1, 2006, 07:44 UTC · re: Juergen Ruehle · lore
On Fri, 1 Dec 2006, Juergen Ruehle wrote:
Show 12 quoted lines
> Jon Smirl writes:
>  > Anyone have a nice script for suppressing diffs caused by CVS keyword
>  > expansion when someone checked the kernel sources into CVS?
> 
> I usually just say (with GNU diff)
> 
>   diff -I $$ ...
> 
> which is crude, but should be enough to get rid of the hunks listed by
> you.
> 
> You might also want -x CVS if you have the metadata files.
Also, if you are actually _using_ CVS to check it out, use
	cvs co -ko
I think, to not check out with keyword expansion at all.
(Also usable with "cvs diff -ko", I think)
		Linus
PS. Clueless user alert: I have happily not used CVS in years and years, 
Jon Smirl· Dec 1, 2006, 15:33 UTC · re: Linus Torvalds · lore
On 12/1/06, Linus Torvalds <torvalds@osdl.org> wrote:
Show 16 quoted lines
>
>
> On Fri, 1 Dec 2006, Juergen Ruehle wrote:
>
> > Jon Smirl writes:
> >  > Anyone have a nice script for suppressing diffs caused by CVS keyword
> >  > expansion when someone checked the kernel sources into CVS?
> >
> > I usually just say (with GNU diff)
> >
> >   diff -I $$ ...
> >
> > which is crude, but should be enough to get rid of the hunks listed by
> > you.
> >
> > You might also want -x CVS if you have the metadata files.

I don't have the original CVS, just a tarball snapshot with the keywords expanded.

I'm working with the Freescale iMX21 and the Linux port for it has never be added to the mainline kernel. I am extracting bits and pieces of it from various vendor tarballs.

Show 14 quoted lines
>
> Also, if you are actually _using_ CVS to check it out, use
>
>         cvs co -ko
>
> I think, to not check out with keyword expansion at all.
>
> (Also usable with "cvs diff -ko", I think)
>
>                 Linus
>
> PS. Clueless user alert: I have happily not used CVS in years and years,
> and I might remember that all wrong.
>
-- 
Jon Smirl
Uwe Kleine-Koenig· Dec 5, 2006, 12:14 UTC · re: Jon Smirl · lore
Hello Jon,
Jon Smirl wrote:
> Anyone have a nice script for suppressing diffs caused by CVS keyword
> expansion when someone checked the kernel sources into CVS?

I have a little script (called rmcvsid) in my private path, that just wraps a Perl oneliner:

	#! /bin/sh
	exec perl -i -p -e 's/\$(Id|Revision):.*?\$/\$$1: \$/' "$@";

This edits inplace all cvs keywords to be not expanded. If you call it for all files *before* you throw them into git, you don't need to suppress the diffs, because there are none.

You may have to add Source, Date and maybe others.

HTH Uwe

-- 
Uwe Kleine-Koenig
Randal L. Schwartz· Dec 5, 2006, 19:45 UTC · re: Uwe Kleine-Koenig · lore
>>>>> "Uwe" == Uwe Kleine-Koenig <zeisberg@informatik.uni-freiburg.de> writes:

Uwe> #! /bin/sh Uwe> exec perl -i -p -e 's/\$(Id|Revision):.*?\$/\$$1: \$/' "$@";

Ow. My eyes hurt from that. How about we rewrite that as a native Perl script:

    #!/usr/bin/perl
    $^I = ""; # this is -i
    while (<>) {
      s/\$(Id|Revision):.*?\$/\$$1: \$/;
      print;
    }
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
Johannes Schindelin· Dec 5, 2006, 19:48 UTC · re: Randal L. Schwartz · lore
Hi,
On Tue, 5 Dec 2006, Randal L. Schwartz wrote:
Show 14 quoted lines
> >>>>> "Uwe" == Uwe Kleine-Koenig <zeisberg@informatik.uni-freiburg.de> writes:
> 
> Uwe> 	#! /bin/sh
> Uwe> 	exec perl -i -p -e 's/\$(Id|Revision):.*?\$/\$$1: \$/' "$@";
> 
> Ow.  My eyes hurt from that.  How about we rewrite that as a native Perl
> script:
> 
>     #!/usr/bin/perl
>     $^I = ""; # this is -i
>     while (<>) {
>       s/\$(Id|Revision):.*?\$/\$$1: \$/;
>       print;
>     }
Hey, that's better! All of a sudden, I understand everything!

Not, Dscho

Uwe Kleine-Koenig· Dec 6, 2006, 10:05 UTC · re: Johannes Schindelin · lore
Hi,
Johannes Schindelin wrote:
Show 9 quoted lines
> On Tue, 5 Dec 2006, Randal L. Schwartz wrote:
> 
> > >>>>> "Uwe" == Uwe Kleine-Koenig <zeisberg@informatik.uni-freiburg.de> writes:
> > 
> > Uwe> 	#! /bin/sh
> > Uwe> 	exec perl -i -p -e 's/\$(Id|Revision):.*?\$/\$$1: \$/' "$@";
> > 
> > Ow.  My eyes hurt from that.  How about we rewrite that as a native Perl
> > script:
I don't like that either, just because it's Perl :-)
Show 8 quoted lines
> >     #!/usr/bin/perl
> >     $^I = ""; # this is -i
> >     while (<>) {
> >       s/\$(Id|Revision):.*?\$/\$$1: \$/;
> >       print;
> >     }
> 
> Hey, that's better! All of a sudden, I understand everything!

I'm not fluent in Perl, and didn't know $^I. Actually, that's better, yes. (And my script is already rewritten.)

One thing I don't like about both scripts is, that the timestamp of a file changes with that, even if there are no changes. Anyone knows another predefined variable/trick that doesn't hurt performance (and readability) too much?

timtowtdi Uwe

-- 
Uwe Kleine-Koenig
Randal L. Schwartz· Dec 6, 2006, 10:08 UTC · re: Uwe Kleine-Koenig · lore
>>>>> "Uwe" == Uwe Kleine-Koenig <zeisberg@informatik.uni-freiburg.de> writes:

Uwe> One thing I don't like about both scripts is, that the timestamp of Uwe> a file changes with that, even if there are no changes. Anyone knows Uwe> another predefined variable/trick that doesn't hurt performance (and Uwe> readability) too much?

You have to do two passes, or a pass-and-a-half, and do the rename/rewrite based on whether anything changed.

"Just a few more lines of code." :) If it's really important, I can be coaxed to dig it up.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
Junio C Hamano· Dec 5, 2006, 19:55 UTC · re: Randal L. Schwartz · lore
merlyn@stonehenge.com (Randal L. Schwartz) writes:
Show 14 quoted lines
>>>>>> "Uwe" == Uwe Kleine-Koenig <zeisberg@informatik.uni-freiburg.de> writes:
>
> Uwe> 	#! /bin/sh
> Uwe> 	exec perl -i -p -e 's/\$(Id|Revision):.*?\$/\$$1: \$/' "$@";
>
> Ow.  My eyes hurt from that.  How about we rewrite that as a native Perl
> script:
>
>     #!/usr/bin/perl
>     $^I = ""; # this is -i
>     while (<>) {
>       s/\$(Id|Revision):.*?\$/\$$1: \$/;
>       print;
>     }
That's kinda surprising coming from the resident Perl guru.

I am so used to the command line "-i -p" that I did not even know what $^I does, and I would have lost without your "# this is -i" comment. That alone makes the Uwe's one more readable for me ;-).

Robin Rosenberg· Dec 5, 2006, 20:30 UTC · re: Junio C Hamano · lore
tisdag 05 december 2006 20:55 skrev Junio C Hamano:
Show 23 quoted lines
> merlyn@stonehenge.com (Randal L. Schwartz) writes:
> >>>>>> "Uwe" == Uwe Kleine-Koenig <zeisberg@informatik.uni-freiburg.de>
> >>>>>> writes:
> >
> > Uwe> 	#! /bin/sh
> > Uwe> 	exec perl -i -p -e 's/\$(Id|Revision):.*?\$/\$$1: \$/' "$@";
> >
> > Ow.  My eyes hurt from that.  How about we rewrite that as a native Perl
> > script:
> >
> >     #!/usr/bin/perl
> >     $^I = ""; # this is -i
> >     while (<>) {
> >       s/\$(Id|Revision):.*?\$/\$$1: \$/;
> >       print;
> >     }
>
> That's kinda surprising coming from the resident Perl guru.
>
> I am so used to the command line "-i -p" that I did not even
> know what $^I does, and I would have lost without your "# this
> is -i" comment.  That alone makes the Uwe's one more readable
> for me ;-).
May I suggest a compromise? : 

#!/usr/bin/perl -i -p s/\$(Id|Revision):.*?\$/\$$1: \$/;

← back to recent threads