Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CVS remove sticky tag without update

Tags:

cvs

CVS is really driving me crazy!

Is there any trick to remove sticky tags without updating file contents? I know of 'cvs up -A' but this also changes my files.

Or the other way round: Is there any way to update a complete directory to a previous date without setting sticky tags in the first place?

Background: I use a working copy that is versioned both with CVS and HG and I messed it up, so I wan't to go back to the latest point where it was in sync and then check what would come in from CVS.

thanks and regards.

like image 659
Peter Avatar asked Jul 09 '13 09:07

Peter


1 Answers

This may depend on your version of CVS, and comes with the caveat that it's not supported, but I used to manually remove the sticky tag from the CVS/Entries file. I did this a lot when I wanted to roll back my working version to a past version but avoid the sticky tag so that I could just update normally when I'm ready.

First, just update the file to the version you want from the repository. For cleanliness I was in the habit of removing my local copy first.

rm myfile
cvs update -r 1.20 myfile

This will of course leave you with the sticky tag.

cvs status myfile
===================================================================
File: myfile      Status: Up-to-date

   Working revision:    1.20
   Repository revision: 1.20    /cvsroot/myproject/myfile,v
   Sticky Tag:          1.20
   Sticky Date:         (none)
   Sticky Options:      (none)

The sticky tag is stored in the CVS/Entries file in the last field. If you look at CVS/Entries with a text editor and search for your filename, you will find this:

/myfile/1.20/Thu Nov  6 18:22:05 2014//T1.20

The T1.20 at the end represents the sticky tag. You can simply remove it, leaving the line:

/myfile/1.20/Thu Nov  6 18:22:05 2014//

Now, the sticky tag is gone. You're in the same state you'd be in if someone had checked in a new version and you simply haven't updated yet.

cvs status myfile
===================================================================
File: myfile      Status: Needs Patch

   Working revision:    1.20
   Repository revision: 1.21    /cvsroot/myproject/myfile,v
   Sticky Tag:          (none)
   Sticky Date:         (none)
   Sticky Options:      (none)

Once you verify that this works on a single file, and get brave, you can do the whole directory at once if you want to, using your favorite tool (perl, awk, etc) to modify every file in the CVS/Entries (or only those lines you wish to modify). You should use caution of course. I use perl, and keep a .backup to fall back on in case of any trouble:

perl -pi.backup -e 's|//T[\.0-9]+$|//|' CVS/Entries
like image 139
biomiker Avatar answered Oct 14 '22 15:10

biomiker