Enjoy life as it comes...

Stephen Weblog

All about me…
Subscribe

Archive for the ‘Manage Source Code’

Manage Source Code Linux Way

February 01, 2008 By: admin Category: Manage Source Code No Comments →

Manage Source Code In Linux Way - At times Developers and Sys Admins would have to work on too many files for maintaining various applications, there could be a situation in which two or more people would work on the same file at a given instance. Makes life really tough, when multiple copies of the same file were maintained in the system. Here we will discuss about one of the mechanism for source code control system RCS.Step 1. We will create a new directory called RCS

stephen@stephen-desktop:~$ mkdir RCS
stephen@stephen-desktop:~$ cd RCS

Step 2. We need to initialize archive file, here we will initialize one archive file with name test.
This will create file test,v.

stephen@stephen-desktop:~/RCS$ rcs -i test
RCS file: test,v
enter description, terminated with single ‘.’ or end of file:
NOTE: This is NOT the log message!
>> .
done
stephen@stephen-desktop:~/RCS$

stephen@stephen-desktop:~/RCS$ ls -tlr
total 4
-r–r–r– 1 stephen stephen 64 2007-08-27 18:19 test,v

Step 3. Create a source file and use ci command to checkin the file into archive.

stephen@stephen-desktop:~/RCS$ vi testfile
stephen@stephen-desktop:~/RCS$ ci testfile
testfile,v <– testfile
enter description, terminated with single ‘.’ or end of file:
NOTE: This is NOT the log message!
>> .
initial revision: 1.1
done
stephen@stephen-desktop:~/RCS$

Step 4. To check out the file from the archive we need to use co command

stephen@stephen-desktop:~/RCS$ co anc
anc,v –> anc
revision 1.1
done
stephen@stephen-desktop:~/RCS$ ls -trl
total 12
-r–r–r– 1 stephen stephen 187 2007-08-27 18:20 test.c,v
-r–r–r– 1 stephen stephen 187 2007-08-27 18:22 testfile,v
-r–r–r– 1 stephen stephen 7 2007-08-27 18:22 testfile
stephen@stephen-desktop:~/RCS$

Step 5. We will then modify the testfile and check in again.

stephen@stephen-desktop:~/RCS$ ci testfile
testfile,v <– anc
ci: testfile,v: no lock set by stephen
stephen@stephen-desktop:~/RCS$ ls -tlr
total 12
-r–r–r– 1 stephen stephen 187 2007-08-27 18:20 test.c,v
-r–r–r– 1 stephen stephen 187 2007-08-27 18:22 testfile,v
-rwxr-xr-x 1 stephen stephen 14 2007-08-27 18:23 testfile
stephen@stephen-desktop:~/RCS$

Step 6.
To check out the file which had initial version we can use this co command followed by the
version number.

stephen@stephen-desktop:~/RCS$ co testfile 1
testfile,v –> testfile
revision 1.1
writable anc exists; remove it? [ny](n): y
done
co: RCS/1,v: No such file or directory
stephen@stephen-desktop:~/RCS$

Thats it, as simple as that, this is one of the tool for maintaining source code in Linux, there are so many
tools such as SCCS, CVS etc, will leave the rest of the tools to reader for exploration. Thanks