[development] CVS issues

Derek Wright drupal at dwwright.net
Thu Mar 29 17:21:47 UTC 2007


On Mar 29, 2007, at 6:11 AM, Richard Morse wrote:

> Is there any way to tell CVS to just undo everything I did yesterday?

yes, but it's a lot of work.

> I want to roll back all the commits, untag everything I did, and  
> undo the branches I made.

all possible, assuming either myself or killes had 1/2 hour or more  
to waste doing this for you.

i know the docs can be daunting, and CVS can seem arcane, but as we  
always say at my day job "it's easier to ask for permission than  
forgiveness". ;)  i.e. i would have much rather spent 10 minutes  
answering your questions than 3 or 5 times that much effort undoing  
your mistakes.

> I've gotten things very messed up because of CVSs weird sticky  
> issues -- I was trying to do development on both 4.7 and 5 at the  
> same time

shouldn't be a problem, i do it all the time.

> (I thought if I had completely different CVS checkouts, in  
> different roots, it would keep track of which tag was proper, but  
> it doesn't).

i don't know what CVS client you're using, and some of them might be  
stupider than others.  however, using the CLI, if you checkout like so:

mkdir drupal-5
cd drupal-5
cvs -d[blah-blah] co -r DRUPAL-5 contributions/modules/foo
cd ..

mkdir drupal-4-7
cd drupal-4-7
cvs -d[blah-blah] co -r DRUPAL-4-7 contributions/modules/foo
cd ..

mkdir drupal-HEAD
cd drupal-HEAD
cvs -d[blah-blah] co contributions/modules/foo

(where "[blah-blah]" is really ":pserver:..." -- i assume everyone's  
familiar with this part -- or, you can just set that in your CVSROOT  
environment variable).

each copy of foo will have a sticky tag that remembers what branch  
it's from (or, in the case of drupal-HEAD, no sticky tag at all,  
which means it's sticky to HEAD).  assuming all future cvs commands  
don't specify "-r", you should never have any problems with this.  if  
you're in one of these workspaces and you do a "cvs update -r  
something" or "cvs update -A", you just undid your sticky tag, so  
don't do that unless you're sure you know what you're doing.

if you're using some GUI, you're at the mercy of the foolish GUI  
writer, who might think they know how to use CVS better than you do.   
i've heard of CVS GUIs that add all sorts of extra garbage to the  
underlying CVS commands that get spit out, which is one of the  
reasons i never use them at all.  so, it's possible your GUI  
"remembered" the last checkout or update command you typed into the  
box, and keeps appending the "-r" all the time, regardless of what  
directory you're in, thereby undoing the entire functionality of  
sticky tags.  personally, i'd rather just learn the tool and then  
have complete control over what's going on.

> Also, is there any way to delete a file from head, but not from the  
> various branches?

sure.  assuming the file exists in the repository and is properly  
added to the other branches, you just do this:

mkdir HEAD
cd HEAD
cvs -d[blah-blah] co contributions/modules/foo
cd contributions/modules/foo
rm file-for-branches.txt
cvs rm file-for-branches.txt
cvs commit -m "file-for-branches.txt shouldn't be in HEAD"

for all it's faults on renaming files, cvs is actually smart about  
the fact that removing a file is an operation specific to a given  
branch.  so, once it's been branched, you have to independently  
remove it from any/all branches where you don't want it anymore.

so, back to your "how do i undo all of this?" question -- i guess the  
next step is finding the appropriate bribe to appease killes or  
myself. ;)  perhaps you should take that part of the discussion off- 
line... ;)

-derek (dww)


p.s. yes, yes, it's possible to use another "-d [local-directory]"  
command later along the command line to checkout stuff in more fancy  
ways that avoids all the "mkdir" and "cd" parts of my instructions  
above.  but that's more confusing and i'm trying to keep this advice  
as simple as possible.



More information about the development mailing list