Repository Fun (was: Bitkeeper outragem, old and new)

John H. Robinson, IV jhriv at ucsd.edu
Wed Dec 4 16:17:03 PST 2002


Lan Barnes wrote:
> On Wed, Dec 04, 2002 at 02:49:51PM -0800, Stewart Stremler wrote:
> 
> -big snip-
> 
> Can you do this with cvs: 
> 

% mkdir /tmp/lbarnes
% cd /tmp/lbarnes
% touch file1
% cvs -d /cvs import -m 'start' lbarnes start init
N lbarnes/file1

No conflicts created by this import

% cd ..
% rm -rf lbarnes
% cvs -d /cvs co lbarnes
cvs checkout: Updating lbarnes
U lbarnes/file1
% cd lbarnes
% mkdir dir1
% touch dir1/fd1
% cvs add dir1
Directory /cvs/lbarnes/dir1 added to the repository
% cvs add dir1/fd1
cvs add: scheduling file `dir1/fd1' for addition
cvs add: use 'cvs commit' to add this file permanently
% cvs ci -m 'added fd1'
cvs commit: Examining .
cvs commit: Examining dir1
RCS file: /cvs/lbarnes/dir1/fd1,v
done
Checking in dir1/fd1;
/cvs/lbarnes/dir1/fd1,v  <--  fd1
initial revision: 1.1
done

> 1. Lay down a tag "version-1_0"

% cvs tag version-1_0
cvs tag: Tagging .
T file1
cvs tag: Tagging dir1
T dir1/fd1

> 2. Rearrange the directory structure of the source tree in any way,
> mentioned or unmentioned.

% echo new info > file1
% mkdir new_dir
% cvs add new_dir
Directory /cvs/lbarnes/new_dir added to the repository
% mv dir1/fd1 new_dir
% echo more new info > new_dir/fd1
% cvs add new_dir/fd1
cvs add: scheduling file `new_dir/fd1' for addition
cvs add: use 'cvs commit' to add this file permanently
% cvs delete dir1/fd1
cvs remove: scheduling `dir1/fd1' for removal
cvs remove: use 'cvs commit' to remove this file permanently
% cvs ci -m 'moved fd1 from dir1 to new_dir' new_dir/fd1 dir1/fd1
RCS file: /cvs/lbarnes/new_dir/fd1,v
done
Checking in new_dir/fd1;
/cvs/lbarnes/new_dir/fd1,v  <--  fd1
initial revision: 1.1
done
Removing dir1/fd1;
/cvs/lbarnes/dir1/fd1,v  <--  fd1
new revision: delete; previous revision: 1.1
done
% cvs ci -m updates file1
/cvs/lbarnes/file1,v  <--  file1
new revision: 1.2; previous revision: 1.1
done

> 3. Lay down a new tag, "version-2_0"

% cvs tag version-2_0
cvs tag: Tagging .
T file1
cvs tag: Tagging dir1
cvs tag: Tagging new_dir
T new_dir/fd1
% cd ..

> 4. Recover a new work directory structure using "version-1_0" that is
> identical to the original 1.0 structure?

% cvs -d :pserver:cvs at sbih.org:/cvs co -d v1 -r version-1_0 lbarnes
cvs server: Updating v1
U v1/file1
cvs server: Updating v1/dir1
U v1/dir1/fd1
cvs server: Updating v1/new_dir
% ls -s v1{,/*dir*} 
v1:
total 16
   8 CVS     8 dir1     0 file1

v1/dir1:
total 8
   8 CVS     0 fd1

> (I'm assuming that any co by tag "version-2_0" will work perfectly ...
> until the next rearrangement.)

% cvs -d :pserver:cvs at sbih.org:/cvs co -d v2 -r version-2_0 lbarnes
cvs server: Updating v2
U v2/file1
cvs server: Updating v2/dir1
cvs server: Updating v2/new_dir
U v2/new_dir/fd1
% ls -s v2{,/*dir*} 
v2:
total 24
   8 CVS     8 file1     8 new_dir

v2/new_dir:
total 16
   8 CVS     8 fd1


it is really rather trivial.
if you use ``export'' instead of ``co'',then you don't get those CVS
dirs. great if you are shipping a tarbal to a client. but you did say
``working directory'' thus i had to use the ``co'' command

you can play, too. use the :pserver: line above. read only, sorry.


-john



More information about the KPLUG-List mailing list