Question

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.

Was it helpful?

Solution

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

OTHER TIPS

You can use the -p option to "cvs up" to write to the standard output, which you can redirect to the original file using ">". This avoids stickiness.

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?

The sticky tag is there to remember that you're not in HEAD. If you commit changes, they won't go there then. And just removing the sticky tag could be dangerous in normal situations.

I think the best way to go is to create a patch from the date the repositories were in sync to an updated copy. Then apply the patch reversed. Create a patch with your modified changes and apply on the other repository.

On a clean (but not synced repo):

$ cvs diff -R -D date_when_synced >patchfile

$ patch -R -pNUM <patchfile

Then in the repo you made the modifications you don't want to lose with cvs up -A:

$ cvs diff -R >patchfile2

Then apply the patch in the "clean" repository:

$ patch -pNUM <patchfile2

I think this could do what you want, if I understood it correctly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top