cvs_keyword_set_to_initial_version

1 view
Skip to first unread message

Arun K. Varghese

unread,
Apr 9, 2014, 11:19:04 PM4/9/14
to info...@nongnu.org


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

unread,
Apr 10, 2014, 12:11:49 AM4/10/14
to Arun K. Varghese, info...@nongnu.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 14-04-09 10:47 AM, Arun K. Varghese wrote:
> 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 :)

> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlNGGewACgkQLdDyDwyJw+OzpwCdH7zhx23oIHPgwZG7c5RYxVm/
bGkAoNifZ/RPhgstZLc5NYo0FjC7HSDB
=ee/5
-----END PGP SIGNATURE-----

Reply all
Reply to author
Forward
0 new messages