uma introdução ao cvs adaptado de apresentação feita por durai raj ( )

63
Uma introdução ao CVS Uma introdução ao CVS Adaptado de apresentação Adaptado de apresentação feita por Durai Raj ( feita por Durai Raj ( http://www.wincvs.org/doc.html http://www.wincvs.org/doc.html ) )

Upload: anthony-arnold

Post on 03-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Uma introdução ao CVSUma introdução ao CVS

Adaptado de apresentação Adaptado de apresentação feita por Durai Raj (feita por Durai Raj (http://www.wincvs.org/doc.htmlhttp://www.wincvs.org/doc.html))

Page 2: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Já aconteceu isto com algum de seus projetos?

Qual é mesmo a última versão?

Só Deus sabe (algumas vezes você também!!)

Por que CVS ?

Page 3: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Um breve histórico do CVS

• CVS começou started como um conjunto de shell scripts escritos por Dick Grune, postado no newsgroup `comp.sources.unix' em dezembro de 1986.

• Em abril de 1989, Brian Berliner projetou e implementou o CVS. Jeff Polk depois ajudou Brian com o projeto do módulo CVS e o suport a vendor branch.

• Desde então o CVS tem sido utilizado por muitos programadores no desenvolvimento de diversos softwares na internet

Page 4: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Requisitos para CV

• Múltiplos Desenvolvedores - Acesso Concorrente• Histórico• Visualização de diferenças• Cancelamento de mudanças (Rollback changes)• Gerenciamento de realiases

Page 5: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

O que é o CVS?

É como se você tivesse seuas arquivos de código fonte em um servidor de arquivos e coordenasse com os seus colegas de trabalho o número de version que você está trabalhando no momento.

Page 6: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Como o CVS funciona?

• CVS usa uma Arquitetura Cliente / Servidor• Um administrador de sistema normalmente instala o

Servidor• O servidor mantem o Repositório• Desenvolvedores usam o Cliente• O Cliente pode efetuar Checking in/out, Atualizar,

etc..

Page 7: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Arquitetura Cliente-Servidor

Repositório Central

• servidor separado (UNIX or NT)

• sem sistema de aquivos compartilhado

•um processo por conexãoAntônio

João

José & Maria

Page 8: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

How Does CVS Version?

• CVS maintains a set of diffs that define the changes between each version

• Any version can be checked out from the repository by specifying the date:

cvs checkout -D yesterday <proj>; or

cvs checkout -D “12 days ago.” <proj>; or

cvs checkout -D “23 August 2002” <proj>;

Page 9: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Idea of CVS

• The idea of the CVS is to create a file system, where each file has remembers all the modifications made to it. In other words it is all the versions of it at the same time.

• File system resides in a repository, that can be stored to local or remote host.

• All the files are edited outside of the repository in some working directory and in some phase synchronized with the repository.

• Files are moved to, from and updated from repository with special tool called cvs, which is available for most platforms

Page 10: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

• CVS 簡介 for Linux• CVS 安裝 for Windows• CVS 設定 for MAC• CVS 指令 Port it to your desired platform環境的應用

Platform Support

Page 11: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

CVS Features

• Concurrent access by multiple developers• Multiple development lines in a single repository• Grouping sources into modules• Symbolic source tagging• Diffs between versions• Configurable logging support• Binary files support• Repository event triggers

Page 12: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Concurrent Versions System

• Overview of CVS architecture.• Repository structure.• Basic development tasks in WinCvs.• Branching and merging.• Other CVS interfaces• CVS internals

Page 13: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Versioning Systems allow:

• multiple users to modify the same code

• To store one master copy of the source code

• To automate the update between versions

• Access to any previous state of the source code

Versioning Systems

Page 14: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Handling Binary Files

• Line Feed Format: Repository vs. Client• Keyword Substitution• Wrappers• cvs admin -kb

Page 15: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Web Access

• Look at CVS tree in the repository• Browsing of a CVS repository

– ViewCVS• http://viewcvs.sourceforge.net/

– CVSweb• http://people.freebsd.org/~fenner/cvsweb/

Page 16: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

CVS do’s and don'ts ……

• Facilitates bug detection when software is modified

• Economy in disk space while saving versions

• Prevents code over-writing in a team project

• Not a build system• Not a substitute for

communication between developers or for management

• It will not create any magic for you.

Page 17: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Limitations

• Best if you have an investment in *nix environments• Designed for programmers• Concepts are hard to grasp• Alien concept to designers

Page 18: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Where it can be used ?

• Software Development • Website Management • Documentations • Synchronization of distributed effort • ... anywhere digital data evolves

Page 19: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

What Is CVS Used For?

• Open Source Projects• Projects With a Large Number of Developers• Storing Files That Benefit From Version Control (

/etc/ config files, or web pages )• Taking Advantage of a Sandboxed Development

Environment

Page 20: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

So What is it good for ?

• Version control and connecting multiple developer together in one project, of course :)

• Document management and archiving • Nice way to do one project with multiple machines

and still manage the versions • Allows free experimenting on project • Following the growth of the project • Backupping - it forces one to take backups with

neglible work very often

Page 21: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Benefits of CVS

• Automatic, constant and forced backupping • When programming, frees the development • Gives freedom to choose afterwards, when the

program is ready • Saves all the versions for later use • Clean way of saving only the necessary files and

managing projects • Gives freedom to develop on multiple machines

simultaneously

Page 22: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Fancy Features

• Multiple developer support (file locking, etc.) • Bonsai - www-interface (for example see Gnome

project) • Keyword substitutions • Development of several version at the same time • Multiplatform-support (works even on obscure

platforms like Windows)

Page 23: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Concurrent checkout

Master Repositoryfoo.c

WorkingCopyV1.7

WorkingCopy V1.1

WorkingCopy V1.2

WorkingCopyV1.7

WorkingCopy

V1.2.2.1

checkout branch rel_1_fix checkout latest

checkout latest

checkoutV1.2

checkoutV1.1Ganesh

Subbu Mansoor

Sundar (Code walkthrough)

Checkout does not lock the files in repository

X XV1.8 or 1.9

V1.8 or 1.9V1.2.2.2

checkin

checkincheckin

checkin prohibited

Gopinath

Page 24: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

CVS and the Development Cycle1. Check out source files in working directory.2. Edit source files.3. Unit test your code.4. Update working files to merge in changes from other

developers (if necessary).5. Test again if the sources were merged on step 4.6. Commit changes.7. Repeat from step 2 until you have a new release.8. Tag the release.9. Submit the module name and release tag for integration

build.

Page 25: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

checkoutupdatecheckindevelopment

Ideal development with CVS

repository

Developer A

Developer B

Page 26: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

checkin

X

Real development with CVS

repository

Developer A

Developer B

updateconflict resolutioncheckin

conflict

Page 27: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

How Do You Setup CVS?

• Most current *nix distribution come with CVS installed from the get go

• Setting up the server basically just requires specifying where the repository will be housed

• In Linux Install gcvs for gui interface• In Win* Install Wincvs • Tortoise CVS is also good

Page 28: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Setting Up the Client

• CVS relies on two main environment variables• CVS_ROOT specifies where the repository is located.

This can be a network address, i.e.. //sdgserver/sdgrepo

Page 29: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Essential CVS Terminology - Repository

CVS stores all files in a centralized directory called the repository. The directory is defined by the environment variable $CVSROOT.

Page 30: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Essential CVS Terminology - Module

Modules are just the top level directories in the Repository.

You can combine multiple modules in your own directory structure. See documentation for CVSROOT/modules

incorporate generic libraries in your own source tree, but be able to maintain them individually.

The files in the repository are organized in modules. Each module is made up of one or more files, and can include files from several directories. A typical usage is to define one module per project.

Page 31: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Version Numbers

• Every file in a CVS repository can contain many versions, which are given version numbers in form x.y[.x.y[...]].

• The history of each file is tracked with an incrementing revision number

• For each revision there is a log entry • Revision numbers have the format 1.25 if they're on

the main trunk, branches have something like 1.33.2.16

Page 32: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Revision numbers

Page 33: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Version Numbers

• Version numbering is automatic i.e. number y is automatically increased every time file is changed:

1.1 1.2 1.3 1.4 1.5

Page 34: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Tags

• A Tag is simply a symbolic name for a specific revision • Tagging all files in one directory or module marks the current

stage. • Can be used as synonym for a revision in any CVS-command • cvs tag <tagname> applies the tag to the current revision of

each file • Version numbers can be treated as a internal information in

CVS and only symbolic names - tags for version used to mark releases.

Page 35: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Branches

• Version number can contain more than two numbers to mark branches.

• Branch can start from any version and start developing independently from the rest of the software.

• In some point of the development of a branch, it can be merged to main trunk in necessary.

Page 36: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Interaction with the repository

• Check out • Syntax : cvs checkout [options] module ...

• Add • Syntax : cvs add [options] file ...

• Remove • Syntax : cvs remove [options] [file ...]

• Examine status • Syntax : cvs status [options] [file ...]

Page 37: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Interaction with the repository – cont.

• Update • Syntax : cvs update [options] [file ...]

• Check in (commit) • Syntax : cvs commit [options] [file ...]

• Release module • Syntax : cvs release [options] module ...

• Import module • Syntax : cvs import [options] repository_dir

vendor_tag release_tag

• Export module Syntax : cvs export [options] module ...

Page 38: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Branches

• Tag – symbolic name for revision of file• ‘-v’ flag in status : see tags and rev. nos.• Tag all files at strategic points – release• ‘-r’ flag in checkout : checkout a rev. no.• Need for branches : good for bug-fixing• Put modified code in branch and later merge with main

trunk

Page 39: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Modules

• modules are alias names to projects kept in the repository.

• More convenient to call a module name rather than a long pathname

Example:

If repository is in

\\Sdgserver\SDGREPO\FCS DRIVERS V1

A module could declare this simply as “DRIVERS”

Page 40: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Defining the module

• Get working copy of ‘modules’ file• Edit file to define new module• Commit changes to ‘modules’ file• Release the working copy• E.g. - $ cvs checkout CVSROOT/modules

new line : newdir newcode/newdir

$ cvs commit –m “Added module” modules

$ cvs release –d modules

Page 41: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

cvs Status

• Status : gives the state of the file• Up-to-date : latest revision• Locally modified : not committed changes• Locally added : added but not committed• Locally removed : removed, not committed• Needs checkout, Needs merge• Unresolved Conflict – update conflict• Unknown

Page 42: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

What is WinCVS?

– WinCVS is a MS Windows GUI CVS client.– WinCVS is an Open Source product, written in MS Visual

C++. Architecture supports different front ends.– Latest version is 1.2.x is stable release– Latest beta version is 1.3b8

Page 43: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

WinCVS on your desktop• Configuration• Main screen• Checking out the sources• Viewing source history• Diff• Commit• Update• Tag

Page 44: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Guided Tour / Demo

• Importing an existing project to the repository• Checking out a project to your work area• Updating your work area• Editing files, checking in/committing new versions to the

repository• Comparing changes between versions (‘diff’ing)• Advanced features• Customising CVS

Page 45: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Guided Tour / Demo

• Importing an existing project to the repository• Checking out a project to your work area• Updating your work area• Editing files, checking in/committing new versions to the

repository• Comparing changes between versions (‘diff’ing)• Advanced features• Customising CVS

Page 46: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Guided Tour / Demo

• Importing an existing project to the repository• Checking out a project to your work area• Updating your work area• Editing files, checking in/committing new versions to the

repository• Comparing changes between versions (‘diff’ing)• Advanced features• Customising CVS

Page 47: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Guided Tour / Demo

• Importing an existing project to the repository• Checking out a project to your work area• Updating your work area• Editing files, checking in/committing new versions to the

repository• Comparing changes between versions (‘diff’ing)• Advanced features• Customising CVS

Page 48: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Guided Tour / Demo

• Importing an existing project to the repository• Checking out a project to your work area• Updating your work area• Editing files, checking in/committing new versions to the

repository• Comparing changes between versions (‘diff’ing)• Advanced features• Customising CVS

Page 49: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Guided Tour / Demo

• Importing an existing project to the repository• Checking out a project to your work area• Updating your work area• Editing files, checking in/committing new versions to the

repository• Comparing changes between versions (‘diff’ing)• Advanced features• Customising CVS

Page 50: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Guided Tour / Demo

• Importing an existing project to the repository• Checking out a project to your work area• Updating your work area• Editing files, checking in/committing new versions to the

repository• Comparing changes between versions (‘diff’ing)• Advanced features• Customising CVS

Page 51: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

WinCVS: Configuration

Your login

Page 52: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

WinCvs: Main screen

file view

status view

modules

stat

e ic

on

revi

sio

n n

um

ber

file

typ

e

Page 53: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Checking out the sources

Page 54: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Source history & diff

Page 55: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Commit, Update & Tag

Page 56: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

When to commit

• Commit to mark a working state that you might want to return to later.

• Commit related files in a single operation. Use a common log message for all the files.

• Commit to backup your sources.• Commit from an office desktop to be able to

access the files from home much faster than through filesystem sharing.

Page 57: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Working on branches

1.1 1.2 1.3

release_1

cvs tag release_1

cvs up -r rel_1_fix

1.4

release_2

cvs tag release_2

1.2.2.1 1.2.2.2

patch

rel_

1_fixcvs tag -b rel_1_fix

Page 58: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Branch if you need ...

• to create sustaining (patch) releases• to have multiple development lines from a

single repository• to do experimental development to merge

later or forget about it• to keep temporary state of development

without affecting builds

Page 59: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Common CVS commandscvs [cvs-options] command [cmd-options]

[files]cvs checkout Check out source for editing.cvs add Add new file/directory to repository.cvs remove Remove an entry from the repository.cvs status Show status of checked out files.cvs log Show revision history for files.cvs diff Compare working files to version in repository

or versions inside the repository.cvs update Bring working files into sync with repository.cvs commit check files into the repositorycvs tag Label the sources.

Page 60: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Advisory locks

Developer A

Developer B

CVS server

edit/watch

Editors:

Developer A

Editors:

Developer A

Developer B

edit

email alert

Page 61: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Links

• Official CVS site: http://www.cyclic.com

• CVS Bubbles: http://www.loria.fr/~molli/cvs-index.html

• CVS for Web development: http://durak.org:81/cvswebsites

• WinCvs: http://www.wincvs.org

• jCVS: http://www.jcvs.org/

• Netscape’s Mozilla under CVS: http://cvs-mirror.mozilla.org/webtools/tindertest/showbuilds.cgi?tree=SeaMonkey

• FreeBSD CVS repository: http://www.freebsd.org/support.html#cvs

Page 62: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

Q&A

Q&AYour Time

Page 63: Uma introdução ao CVS Adaptado de apresentação feita por Durai Raj (  )

About

For suggestions : [email protected]

Thanks to Open Source CommunityThanks to all my team members for their comments and suggestions.A special thanks to Vijay Ananth K for his motivation.