Course Name: High Level Programming Language Year : 2010 Concurrent Versions System Lecture 5 Learning Outcomes At the end of this lecture, students are capable of: • Using CVS (Concurrent Version System) 3 Outline Materi • • • • • Problem in creating a good program Solution to the above problem What is CVS? Software Cyclus Using winCVS 4 Problem in creating a good program 5 Problem in creating a good program • Bugs that has already been fixed, suddenly reappearing • Do not know the last version of a particular version of the program • The last version, apparently erased with the older version 6 Problem in creating a good program • The documentation is not inline with the program that is being made • Do not know whether the changes that have been proposed, had been implemented or not in that particular program 7 Problem in creating a good program • Which version that need to be used? • I have lost my last revision of my program 8 Solution • You need to learn a revision control software, which is called CVS – Concurrent Version System 9 What is CVS? • A process that identifies and combines files that are part of the whole one result software. By controlling the changes that were made during the creation of that software. • To arrange different version in that software’s project. • To be able to return to the previous version of that software (because it can be happened that the previous version is better than the newer one) 10 Software Cyclus Analysis of Users Requests Specifies the goals of the Software Design of Software Specification Design Coding Code Program Test function and data Testing Implementation Operasional System 11 Using winCVS • Setting up winCVS • Projek in winCVS • Using winCVS 12 RCS and History from Control Versioning System • RCS: – Design by Walter Tichy, Faculty of Computer Science, Universitay of Purdue. – RCS is a software tool for Unix’s machine, that allows us to control a system that “has a lot of revision, e.g.: text, program or even documents” 13 About Concurrent Versions System (CVS) CVS is system that control versioning or revision of program or data. CVS is used to record history of program’s files. Bugs can happen during software’s modification, and probably will not be detected after a long time after that modification was done. With CVS, you can open an old file record, before that modification and finding out what causes the bugs. CVS can also be useful for a project that is being done by a couple of people, in which the repository can be overlapped easily between one’s work and the others. CVS can handle this problem by providing each of the developers their own directories. And later on ask CVS to do merging from the results of each developer. CVS files are recorded using RCS systems, in which RCS is an abbreviation of Revision Control System. 14 Model Check In - Check Out • Each programmer works in his/her own local area. • After the program is revised, then that program has to check-in to a central repository. • Program insides the central repository has to be checked-out first, before they can be modified. 15 Example of File CVS *,v – edit helloworld.c,v 1.1 log @Initial revision @ text @#include void main(void) { printf("Hello, world!\n") } @ 16 Setting Up CVS – First, set variable CVSROOT to …/`username`/…/cvsroot – (c:\cvsroot ) • Run program wincvs. • And then run cvs -d :local:c:\cvsroot init • The action above will create cvsroot’s directory as the central repository 17 Placing a Project File into the CVS Repository – Supposed you have a file in c:\HelloWorldCVS – Then type: cd HelloWorldCVS – After that do Remote: Import module cvs import -I ! -I CVS -m "Importing data to repository central CVS" HelloWorldCVS avendor arelease (in directory C:\HelloWorldCVS\) 18 Accessing CVS Repository – cd to your local directory, in which you are working with (cd HelloWorldCVS) – cvs checkout -P HelloWorldCVS (in directory C:\HelloWorldCVS) – Creates a project directory inside HelloWorldCVS and put the newest file from the repository – Make changes to that file – And then do: cvs commit -m “Add new coding" hello.c 19 Updating Local Area in CVS – cvs update <filename> • To compare files in working copy with the one in the repository. • cvs update -P hello.c (in directory C:\HelloWorldCVS\HelloWorldCVS\) • M hello.c • Modified: means that file hello.c has been changed to a working copy 20 Updating Area Lokal dalam CVS – To see differences made between files in working directory and in repository, you can use a command: diff(erent) – cd ke projek direktori lokal – cvs diff cvs diff hello.c (in directory C:\HelloWorldCVS\HelloWorldCVS\) Index: hello.c =========================================================== ======== RCS file: c:/cvsroot/HelloWorldCVS/hello.c,v retrieving revision 1.1.1.1 diff -r1.1.1.1 hello.c 3a4 > printf ("Goodbye, world!\n"); 21 Add/Delete file in CVS – Add a new file • • • • Get a working copy of the module. Create the new file inside your working copy. cvs add filename : CVS version controls it cvs commit filename : add it to repository – Delete a file • rm filename • cvs remove filename • cvs commit filename 22 The Achieved Objectivites – Now, You have been able to: • Setup CVS – creating a repository • Placing a project inside CVS repository • Using CVS. – Next Exercises: • What does it mean by branching and why is it useful? • Explain the following cvs commands: cvs tag release-1, cvs checkout -r release-1 project, cvs release -d project, cvs rtag -b -r release-1 release-1-patches project, cvs checkout -r release-1-patches project, cvs checkout -j release-1-patches project, cvs commit -m “Merged patch”,… 23 Conclusion • In order to create a complex software with a groups of software engineers, we need a CVS software to control our versioning. • WinCVS is one such software that implements CVS mechanism, such as create repository, check in, check out, etc. 24 Topic For Next Week • Classes • Assignment (taken from book “Cpp Essentials.pdf” page 113, chapter 6 – Classes): 1. Define a class named “Complex” for representing complex numbers. A complex number has the general form a + ib, where a is the real part and b is the imaginary part (I stands for imaginary). Complex arithmetic rules are as follows: 25 Topic For Next Week (a + ib) + (c + id) = (a + c) + i(b + d) (a + ib) - (c + id) = (a + c) - i(b + d) (a + ib) * (c + id) = (ac - bd) + i(bc + ad) Define this operations as member functions of class “Complex”. 26