cvs using and administration. purpose of configuration management work with cvs – philosophy using...

Post on 16-Jan-2016

229 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

CVS USING AND ADMINISTRATION

Purpose of Configuration management Work with CVS – philosophy Using CVS with Eclipse CVS Administration Q&A

AGENDA

© UNICORN 2004

INTRODUCTION TO CONFIGURATION MANAGEMENT

CONFIGURATION MANAGEMENT

Configuration Management (CM) is the process of defining and controlling a product structure and its related documentation. CM includes maintaining revision control and history information about all changes to a document or product.

The process of identifying and defining Configuration Items in a system, recording and reporting the status of Configuration Items and Requests For Change, and verifying the completeness and correctness of Configuration Items.

Management of the various versions of files that contribute towards a working system.

CM PURPOSE

A CM System is essential for controlling the numerous artifacts produced by the many people who work on a common project. Control helps avoid costly confusion, and ensures that resultant artifacts are not in conflict due to some of the following kinds of problems:

Simultaneous update– When two or more team members work separately on the same

artifact, the last one to make changes destroys the work of the former

Limited notification– When a problem is fixed in artifacts shared by several

developers, and some of them are not notified of the change. Multiple versions

IMPORTANT TERMS

Baseline (build) Is a 'snapshot' in time of one version of each artifact in the

project repository. It provides an official standard on which subsequent work is

to be based, and to which only authorized changes can be made.

After an initial baseline is established every subsequent change to a baseline is recorded as a delta until the next baseline is set.

IMPORTANT TERMS II

Product directory structure Serves as a logically nested placeholder for all versionable

product-related artifacts.

IMPORTANT TERMS III

Workspace Refer to ‘private’ areas where developers can implement and

test code in accordance with the project’s adopted standards in relative isolation from other developers.

Configuration Manager needs to create a workspace environment for each developer on the project.

CM & RUP

CM IN RUP - OVERVIEW

CM IN RUP - ACTIVITIES / ROLES

CM AND CRM

Involves Identifying configuration items Restricting changes to those items Auditing changes made to those items Defining and managing configurations of those items

The methods, processes, and tools used to provide change and configuration management for an organization can be considered as the organization’s CM System.

© UNICORN 2004

CVS PHILOSOPHY

WHAT IS CVS

Concurrent version system Version control system Network-transparent program that allows developers to keep

track of different development versions of source code Its client-server access method lets developers access the

latest code from anywhere there's an Internet connection Useful, when a group of people work on the same project

even for individual developers Uses “Copy-Modify-Merge” model Primarily determined for storing text files It easy retrieve old version of the files Basic tool for team development and for Configuration

Management work

WHAT CVS IS NOT

CVS is not a build system CVS is not a substitute for management CVS is not a substitute for developer communication CVS is not an automated testing program CVS does not have change control CVS does not have a built-in process model CVS does not use a „Lock-Modify-Unlock“ model

ANOTHER CM TOOLS

BitKeeper Microsoft Visual Source Safe (VSS) RCS

The CVS ancestor Uses „Lock-Modify-Unlock“ system

SCCS ClearCase Subversion

BASIC CVS TERMS I

CVS repository The master copy, where CVS stores a projects full revision

history Stores a complete copy of all the files and directories which

are under version control Each project should have exactly one repository Resources are placed in modules, modules can be divide into

folders

Working copy This directory contains local copy of the repository In this place we actually make changes to a project Each developer has his own working copy

BASIC CVS TERMS II

Checkout It’s the process of getting your own working copy of the CVS

resource (module) from the repository Commit

Release changes from working copy into the repository Update

Bring others changes from the repository into own working copy

Also shows, whether our project has uncommitted changes

BASIC CVS TERMS III

Revision Committed change of the history of a file (set of files) “Snapshot” of the permanently changing project

Conflict Situation, when two developer try to commit changes to the

same region of the same file

CVS & FILE TYPES

Text files CVS is primary intended to manage files of this types Files, which contains only characters (.txt, .java, .xml, …) Commit cause, that into the file is stored information only

about changes (not whole file content) It is possible to compare changes between revisions

Binary files Files, which do not contains only textual information (pictures,

database files, archives – jars, zip, … ) Commit cause, that new changed file version is stored into

the CVS as whole It is not possible to compare changes between revisions

REPOSITORY LOCATIONS

/usr/local/UES_AF Local managed repository Used if repository is located on the same machine

:pserver:vigc22@usocvs:2401/opt/cvs/CVSTrain Used if repository is located on the remote server

CVS connect string contains Service, which provide a access to the CVS CVS username Name/IP address of the computer with CVS Port on which CVS service operate Repository location

CHECKOUT

Overview

COMMIT

Overview

UPDATE

Overview

REVISIONS I

When the file is committed into the CVS, it is marked with a “revision” number

When the file is founded into the head, its revision number is 1.1

When the commit is performed, CVS server automatically increase the rightmost number by one

REVISIONS II

Changes & revisions

TAGGING

Tag gives a label to the collection of revisions represented by one developer’s working copy

Tag is a designation for a user version Tag is applied under the file committed in the

repository, not committed files are not tagged! Tag in the CVS is always connected to the file(s), does

not exist without files!

TAGGING I

Tagging is made under the files in the CVS

TAGGING II

Tags & revisions

CONFLICT I

Developer A work on the file1, version 1.1 Developer B work on the file1, version 1.2 too They both work on the same part of the document Developer A commit changes into the repository Developer B is trying commit his changes too – CVS

will be report problem Developer B must merge his changes with changes from

developer A

CONFLICT II

Users are checking project from CVS

CONFLICT III

Both users modify the same file

CONFLICT IV

First user is able to commit changes, the second no

SOLVING A CONFLICT

What conflict mean and how to solve it Conflict is rise because of parallel development – CVS does

not lock modifying files Conflict is solved with communication between developers

– CVS is not a communication tool ! File is modified, marked as merged and committed into the

CVS again

BRANCHING I

When we use branches We made a release and develop a new functionality to the

head of the CVS After some time the customer require a patch for his release We cannot make a patch under the version, which is in the

head – change may be incompatible and unstable We make a “branch” under the version, that we released and

patches will be committed in this branch It is the independent development line and with no influence

to the head and other branch It is the good idea to merge a patch into the head too (if the

error is not repaired yet in the head)

BRANCHING II

Branches and commits

BRANCHING III

Merging changes into the head

REVISIONS & BRANCHES I

Revision with branches

REVISIONS & BRANCHING II

Branches and their revisions

© UNICORN 2004

USING CVS WITH ECLIPSE

PREREQUISITIES

Eclipse platform, version 3.0.1 (last stable) J2SDK 1.4.2 Shared repository /CVSTrain Private repository (/cvs/TrainXX )

TRAIN PROJECT STRUCTURE I

Overview

TRAIN PROJECT STRUCTURE II

Application src/java

– Java sources bat

– *.bat files xml

– Xml configuration files build.xml

– Ant building file

Database contains train database files (*.sql)

THIRDPARTY Contains external (thirdparty ) libraries - *.jar files

ADD NEW CVS REPOSITORY I

If we want to use a CVS, we have to define a path to the new CVS – add a new CVS repository location

This can be done by open new perspective (CVS) or open existing

In the upper right corner

ADD NEW CVS REPOSITORY II

In CVS perspective we must add new repository Click by right mouse button into the CVS Repositories

view

ADD NEW CVS REPOSITORY III

Now we add new repository location

ADD NEW CVS REPOSITORY IV

Now we see complete CVSROOT path in the CVS repositories view

SHARING A PROJECT

We will append the project in the Java perspective Right click on the project Application and choose

Team/Share project

SHARING A PROJECT

Leave opinion “Use project name …” and choose “Next” button

Leave “Use existing …” and choose “Next” button

SHARING A PROJECT

Now you can see, what project is appended into the CVS repository

Now press No button

COMMIT CHANGES I

In the package Explorer now we can see uncommitted files – marked with ‘>’ character

For commit – mark requested files and choose with right click Team/commit

COMMIT CHANGES II

In the next window write a commit comment

Now we can see a commit result

CVS IGNORE FILES I

Sometimes we need, that the CVS ignore some project files/directories (e.g. class output folder)

We can tell Eclipse to add this files to the cvsignore list

In the case, we choose Commit under the whole project, “ignored” files will not be committed and will not be marked as uncommitted

CVS IGNORE FILES II

Choose the Resource view Mark all files and directories, except bin directory

(output folder) Commit this files into the repository Now mark bin directory Now add files to .cvsignore

CVS IGNORE FILES III

Now the only uncommitted file is file: .cvsignore – let’s commit it

On the next screen you can choose possibilities for adding files to the cvsignore list

Add exactly defined file name Wildcard extension – file extension (e.g. *.class files) Custom pattern (regular expression for file names)

We will choose Resource(s) by name

CVS CHECKOUT

It’s the process of getting your own working copy of the CVS resource (module) from the repository

Change perspective to “CVS repositories“ Unfold the CVS repository/HEAD Choose checkout on the project THIRDPARTY Project THIRDPARTY will appear in the

workspace

CVS TAG I

For tag – mark requested files (project) and choose with right click Team/Tag as Version

CVS TAG II

There are uncommitted files in the project – tag will be applied only on the existing revisions

CVS TAG III

Choose the tag name – it should use some system and be descriptive

CVS TAG VI

File and its CVS history

CVS TAG V

Show projects tags – refresh must be performed

CVS TAG VI

Project tags menu

CHECKOUT FROM TAG

Overview

COMMIT TO THE TAG

It is unable to commit changes to the tagged version – tag is only mark

BRANCHING I

Choose branching from menu

BRANCHING II

Choose branch name

BRANCHING III

File version after commit

SYNCHRONIZATION WITH R. I

It is a process of comparing changes in your working copy of repository to the repository

According to the result of synchronization you can provide commit, update, add files to version control etc. on any resource or on all of them together

It is also possible to see the conflict places and you can resolve them one by one

After synchronizing you will see all differences between repository and your

workspace new view is open and you can switch between three

modes– Incoming Mode– Outgoing Mode– Incoming/Outgoing Mode

SYNCHRONIZATION WITH R. II

Choose synchronization

SYNCHRONIZATION WITH R. III

Incoming mode Files are marked with black arrows Files were changed and committed into the CVS by another user

and there is no conflict You can update your workspace files from repository You can compare file by double-clicking on it

SYNCHRONIZATION WITH R. IV

Outgoing mode Files are marked with black arrows Show files, which are changed against the repository You can compare file by double-clicking on them

SYNCHRONIZATION WITH R. V

Incoming-Outgoing mode Show both – incoming and outgoing mode together Files are marked with different arrows

SYNCHRONIZATION WITH R. VI

Incoming mode Update

– This operation retake changes from repository – files are synchronized

Override and commit– This explicitly replace file in the repository with your local copy– Usually this is not a good practise

Outgoing mode Commit

– This will be propagate changes from your local copy into the repository

Override and Update– This will ignore changes, you have done in the workspace and

replace files from repository

SYNCHRONIZATION WITH R. VII

File comparison You can compare incoming either outgoing files by double-

clicking on it For incoming files you can simply retake needed file lines

from repository file

MERGE BRANCH INTO HEAD I

Checkout head version of the project Choose merge from Team menu

MERGE BRANCH INTO HEAD II

Select start point

MERGE BRANCH INTO HEAD III

Select point, from which to merge

MERGE BRANCH INTO HEAD IV

Synchronize changes

CONFLICT I

Developer A work on the file1, version 1.1 Developer B work on the file1, version 1.2 too They both work on the same part of the document Developer A commit changes into the repository Developer B is trying commit his changes too – CVS

will be report problem Developer B must merge his changes with changes from

developer A

CONFLICT II

After synchronization

CONFLICT III

Conflict lines

CONFLICT VI

File after update

CONFLICT V

Merging changes

DELETING A FILE I

Delete file from workspace

DELETING A FILE II

Enter a commit info and commit

DELETING A DIRECTORY I

When we want to delete a directory, its enough to delete all files in this directory

It is unable physically delete a directory from the CVS (from client application)

ECLIPSE PROPERTIES I

Eclipse menu

ECLIPSE PROPERTIES II

Team properties

ECLIPSE PROPERTIES III

CVS properties

ECLIPSE PROPERTIES IV

Team properties

ECLIPSE PROPERTIES V

CVS properties

ECLIPSE PROPERTIES VI

Ext Connection method

ECLIPSE PROPERTIES VII

Label decorations

ECLIPSE PROPERTIES VIII

Password management

ECLIPSE PROPERTIES IX

Password management - general

ECLIPSE PROPERTIES X

Password management – key management

ECLIPSE PROPERTIES XI

File content

ECLIPSE PROPERTIES XII

Ignored resources

IMPORTANT NOTE

Be patient, when copy files(directories) from one directory to another

Directory contains CVS dir – information about directory placement in the repository

When commit is performed, the file from original location is modified

© UNICORN 2004

CVS & COMMAND LINE

CVS & COMMAND LINE I

Requirements Executable cvs in the path (cvs.exe in the Windows

systems) CVS connect string Work directory

CVS & COMMAND LINE II

Define path to the CVS repository Externally – set environment variable CVSROOT

set CVSROOT= :pserver:vigc22@usocvs:2401/opt/cvs/CVSTrain

In the cvs command

cvs –d :pserver:vigc22@usocvs:2401/opt/cvs/CVSTrain …

Before we use cvs, we have to perform commandcvs login

CVS & COMMAND LINE III

Checkout parameters-P – don’t check empty directories-D date – checkout file, not recent like date

-R recursive checkout (implicit parameter)-r tag – checkout with tag tag-d – checkout into the directory dir

CVS & COMMAND LINE IV

Checkout – checkout THIRDPARTY from CVScvs checkout THIRDPARTY

Checkout only one filecvs checkout THIRDPARTY/lib/classes12.jar

Checkout project with tag and prune empty directoriescvs checkout –P –r TAG1 THIRDPARTY

Checkout project from Head from yesterdaycvs checkout –D yesterday THIRDPARTY

Update project cvs update

CVS & COMMAND LINE V

Add new file(s) to the repository Add file as a text

Cvs add <filename> Add file as a binary

Cvs add –kb <filename>

The file has to be committed then

CVS & COMMAND LINE VI

Commit (check-in) Commit is performed under the files in the module – the

working directory must be inside the project! When the comment is not set, the default editor is opened

and you have to write a commit comment Only changed files are committed into the repository When the project with branch is checked, the commit is

performed into the branch too

Commit all files in the current project (and in the subdirectories and add comment)

cvs commit –m “Bug ID 225 repaired”

CVS & COMMAND LINE VII

Revisions – tagging in the checked projectcvs tag <tagname> Tag file with tag <tagname1> with tag <tagnamenew> toocvs tag –r <tagname1> <tagnamenew>

In the remote projectcvs rtag <tagname> <project-name>

Delete tag from projectcvs rtag –d <tagname> <project>

CVS & COMMAND LINE VIII

Revisions – branching in the checked projectcvs tag –b <branchname> branch file with branch <b1> with branch <bnew> toocvs tag –b –r <b1> <bnew>

In the remote projectcvs rtag –b <branchname> <project-name>

Delete branch from projectcvs rtag –d <branchname> <project>

When branch is created, project has to be rechecked from CVScvs checkout –r <branchname>

CVS & COMMAND LINE IX

Removing files You should do:

Delete a file from disc cvs remove <filepath> Cvs commit

$ rm –f lib/classes12.jar$ cvs remove lib/classes12.jar

(cvs remove: Removing .cvs remove: scheduling lib/classes12.jar for removalcvs remove: use ’cvs commit’ to remove these files

permanently$ cvs commit –m “File removed”

CVS ENV VARIABLES I

$CVSIGNORE Whitespace-separated list of filename patterns,

which will be ignored $CVSWRAPPERS

Whitespace-separated list of filename patterns, which will be treat as wrappers

$CVSREAD Is set, checkout and update will try make files in

working directory as read-only $CVSUMASK

Controls permissions of files in the repository

CVS ENV VARIABLES II

$CVSROOT Full pathname to the CVS source repository

$EDITOR, $CVSEDITOR, $VISUAL Program for recording log messages during

commit $HOME, $HOMEPATH, $HOMEDRIVE

Used to locate directory with .cvsrc file $CVS_RSH

Specify external program, which cvs connect with, when :ext access method is used

CVS ENV VARIABLES III

$CVS_PASSFILE Pass file, used when accessing server (or cvs

login server) $CVS_CLIENT_PORT

Port used for access to CVS server $CVS_CLIENT_LOG

File name used for debugging Comm from server $CVS_CLIENT_LOG.out Comm from server $CVS_CLIENT_LOG.in

Q & A

top related