[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Newby : moving/renaming files loses version information?

From: Thornley, David
Subject: RE: Newby : moving/renaming files loses version information?
Date: Wed, 16 May 2001 09:13:04 -0500

> -----Original Message-----
> From: address@hidden [mailto:address@hidden
> Sent: Wednesday, May 16, 2001 7:43 AM
> To: Hondros, Constantine
> Cc: 'address@hidden'
> Subject: Re: Newby : moving/renaming files loses version information?
> "Hondros, Constantine" <address@hidden> writes:
> > Does moving / renaming a file in CVS necessarily mean that 
> the "new" file
> > ends up at version 1.1?
> If you do it in the way you describe (which is the only way that I
> know about to do it without directly frobbing the repository) then
> yes.
Since it is generally advised to ignore the version numbers and keep
track of things with tags, this is not usually a problem.  It is possible
to do "cvs commit -r <new version number>", but that usually doesn't buy
you anything.

> > I followed the instructions at the (excellent) red-bean CVS 
> tutorial thusly
> > :
> > 
> > floss$ mv oldname newname
> > floss$ cvs remove oldname
> > floss$ cvs add newname
> > floss$ cvs ci -m "renamed oldname to newname" oldname newname
> > 
> > and found that the "newname" file started at version 1.1. 
> > 
> > Is this situation avoidable?
> Yes, if you're willing to move things around in the repository itself,
> and if you're willing for the resulting file to show up in the old
> location when you do a checkout based on an old date or tag. 
> Just do this:
> 1) in the repository, do "cp oldname,v newname,v"
> 2) in a work directory, do "rm oldname; cvs remove oldname; 
> cvs commit"
> 3) Still in the work directory, do "cvs update" to get a 
> working copy of newname.
This keeps the history, but has the potential to check the file out
twice.  If I do that, I always remove all the tags from newname
(cvs stat -v to get the tags, cvs tag -d TAGNAME newname to get rid
of the tags).  If the file is on active branches, it's better to
get rid of version tags only, and kill oldname on all branches by
"cvs update -r <branch tag> oldname; rm oldname; cvs rm oldname;
cvs commit", branch by branch.

Every way of renaming a file in CVS has awkwardnesses or inconveniences.
If you move the file in the repository, you lose the ability to check
out the file with the right name for previous tags or dates.  If you copy
the file in the repository, you can wind up getting two copies.  If you
remove and readd without touching the repository, you've split the history
and made it difficult to get diffs between versions.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]