Discussion:
cvs_keyword_set_to_initial_version
Arun K. Varghese
2014-04-09 14:47:38 UTC
Permalink
Hi All,

I am facing an issue with keywords in CVS.

The issue is

we checked out one file a.c , from linux 2.6.28 ( linux.org). Then checked in the file to our CVS server. Multiple people have have checked in the file a.c

Now when I am checking out , I can see that the keywords are changed & it shows the name of the last person who have checked in that file. I have tried with CVS -ko flag, which will only able to go back to just previous check in detail.

So is there any way to replace the current CVS keyword information with the original one, that is the first checked in file's cvs keyword information.

[ by cvs -kk, we can disable the keyword expansion, but it will remove the original authors information also. ]

Thanks & Regards,
Arun K Varghese
Jim Hyslop
2014-04-10 04:11:24 UTC
Permalink
Post by Arun K. Varghese
Now when I am checking out , I can see that the keywords are
changed & it shows the name of the last person who have checked in
that file. I have tried with CVS -ko flag, which will only able to
go back to just previous check in detail.
That's how keywords are supposed to work. They are modified each time
you check them in. As you have discovered, if you want to maintain
information across versions, don't use keyword substitution :)
Post by Arun K. Varghese
So is there any way to replace the current CVS keyword information
with the original one, that is the first checked in file's cvs
keyword information.
A shell script containing something like this should do it:

AUTHOR=`cvs -q up -p -r 1.1 $1 | grep '\$Author' | sed
's/[^$]*\\$//;s/\$.*//'`
sed -i "s/\$Author.*\$/$AUTHOR/" $1

The '-r1.1' option tells CVS to retrieve revision 1.1 from the
repository, and the '-p' option tells CVS to pipe the output to stdout.

If you were the author who first checked it in, and I was the latest
person to modify it and check it in, then the file would change from:

/* $Author: jim $ */

to:

/* Author: arun */

I'm sure someone with more shell scripting experience can come up with
something more elegant, but that should do the job. I'm assuming that
your shell scripting skills are enough that you can understand what
the sed and grep commands are doing; if not, let me know and I'll
break it down in more detail for you.

- --
Jim Hyslop
Dreampossible: Better software. Simply. http://www.dreampossible.ca
Consulting * Mentoring * Training in
C/C++ * OOD * SW Development & Practices * Version Management

Loading...