Sophia Antipolis Introduction to version control David Rey
DREAM 15 dec. 2004
Slide 2
Sophia Antipolis Overview l Collaborative work and version
control l Main CVS user commands l Advanced use of CVS l CVS server
at INRIA Sophia Antipolis
Slide 3
Sophia Antipolis Overview l Collaborative work and version
control l Main CVS user commands l Advanced use of CVS l CVS server
at INRIA Sophia Antipolis
Slide 4
Sophia Antipolis Collaborative work and version control:
examples l Development Source files: C, C++, java, Fortran, Tcl,
Python, shell scripts, Build/config files: Makefile, ant, l Text
documents/articles/bibliographies Plain text Latex/bibtex l Web
pages Html Php, javascripts, l XML documents l... ASCII
documents
Slide 5
Sophia Antipolis A software development process at INRIA l
INRIA recommandations about software development:
http://devel.inria.fr/recom/ http://devel.inria.fr/ l In
particular, concerning version control:
http://devel.inria.fr/recom/processus/main005.html#toc8
Slide 6
Sophia Antipolis Version control main ideas l Distributed
documents/collaborative work Automatic merging Alarms on conflicts
Ease the communication between users (log messages, emails, ) l
Version control: incremental versions All previous versions
available Minimal necessary disk space (incremental) History of
changes/logs
Slide 7
Sophia Antipolis Version control software l CVS:
http://www.cvshome.orghttp://www.cvshome.org l Arch:
http://www.gnu.org/software/gnu-arch/http://www.gnu.org/software/gnu-arch/
l Subversion:
http://subversion.tigris.org/http://subversion.tigris.org/ l Forges
that use version control software:
(http://devel.inria.fr/recom/processus/main005.html#developpement_forges)http://devel.inria.fr/recom/processus/main005.html#developpement_forges
GForge : www.gforge.orgwww.gforge.org Savannah :
savannah.gnu.orgsavannah.gnu.org LibreSource :
libresource.inria.frlibresource.inria.fr Visual Source Safe (pour
Windows) :
msdn.microsoft.com/vstudio/previous/ssafemsdn.microsoft.com/vstudio/previous/ssafe
Slide 8
Sophia Antipolis CVS: Concurrent Version System l Widely used
on a lot of different platforms (Linux, Windows, ) l Open source
license l For local and/or distant usage l Recommended for INRIA
software developments l Several clients possible Command line GUI:
tkCVS, jCVS, WebCvs, Jalindi igloo, WinCVS, TortoiseCVS
Slide 9
Sophia Antipolis What CVS is for ? l Several users work
together at the same time on the same files (concurrency) l Version
control Tags Version comparisons Multiple lines of development in
the same base Branching Support for binary files Event control
(e.g. notification)
Slide 10
Sophia Antipolis What CVS is not for ? l Backup l Bug tracking
l Source documentation l Dependencies l
Slide 11
Sophia Antipolis Overview l Collaborative work and version
control l Main CVS user commands l Advanced use of CVS l CVS server
at INRIA Sophia Antipolis
Slide 12
Sophia Antipolis CVS: client/server architecture 2
possibilities: Shared directory CVS server CVS Clients Local
Client/Server CVS Clients
Slide 13
Sophia Antipolis CVS hierarchy l Repository root or CVSROOT
Looks like cvs-sop.inria.fr:/CVS/SmartTools set the CVSROOT
environment variable on UNIX systems configure an item in the setup
menus of a GUI client Use the command line: cvs d CVSROOT l Modules
For example SmartTools uses 3 modules: SmartTools,
SmartToolsAddons, Documents l Directories Each module contains an
arbitrary hierarchy of directories l Files (incremental diff
versions of)
Slide 14
Sophia Antipolis CVS hierarchy : an example
cvs-sop.inria.fr:/CVS/SmartTools REPOSITORY (CVSROOT)
SmartToolsAddons SmartTools Documents ant demo doc src eg.exe web
latex MODULES FOLDERS AND FILES
Slide 15
Sophia Antipolis CVS help cvs --help-commands (list available
commands) cvs --help-options (list general options) cvs -H import
(specific help for a command and its specific options, e.g. import)
CVS general options + specific command options are different : cvs
[general options] [specific options]
Slide 16
Sophia Antipolis CVS --help-commands
Slide 17
Sophia Antipolis CVS --help-options
Slide 18
Sophia Antipolis CVS -H import
Slide 19
Sophia Antipolis Import l Used to synchronize a local tree as a
whole with the server l Most often used to initialize the server
tree l Can also be used after this initial step at any time (to
avoid one-by-one files addition) l cd local_directory l cvs import
m message directory_on_base branch_name version_name
Slide 20
Sophia Antipolis Checkout and update l cvs -d cvsroot checkout
module_name l cvs update d directories/files U: updated P: the
version on the server is newer and the local copy has been updated
M: modified (or merged), the local file is different from the
server file and merge was done in the local copy ?: unknown, this
file is present locally and not in the CVS base A: added, this file
is present locally and has been added (before commit) R: removed,
this file is not present locally and has been removed (before
commit) C: conflict, the local file has been marked with conflict
markers which identify the different conflict locations
Slide 21
Sophia Antipolis Checkout: example
Slide 22
Sophia Antipolis Update: example
Slide 23
Sophia Antipolis Commit l cvs commit -m my message
directories/files l Always use explicit messages !!! l List of
forbidden messages: my message ? modification of file toto.tex
which modification ? bug fixed which bug ?
Slide 24
Sophia Antipolis checkout Ideal Development (1/4) base
Developer A Developer B
Slide 25
Sophia Antipolis development Ideal Development (2/4) base
Developer A Developer B
Slide 26
Sophia Antipolis checkin Ideal Development (3/4) base Developer
A Developer n
Slide 27
Sophia Antipolis update Ideal Development (4/4) base Developer
A Developer B
Slide 28
Sophia Antipolis checkin Real Development (1/5) base Developer
A Developer B
Slide 29
Sophia Antipolis checkin X Real Development (2/5) base
Developer A Developer B
Slide 30
Sophia Antipolis Real Development (3/5) base Developer A
Developer B update conflict
Slide 31
Sophia Antipolis Real Development (4/5) base Developer A
Developer B Conflict Resolution
Slide 32
Sophia Antipolis Real Development (5/5) base Developer A
Developer B checkin
Slide 33
Sophia Antipolis Conflicts l Do not panic! Many problems are
easy to fix Generally, it does not require a lot of interaction l
If necessary, discuss with people to find a compromise Meetings
Email Phone l Usually can be avoided with regular updates
Slide 34
Sophia Antipolis Status, log, diff, annotate l cvs status
filename Gives information about local file with comparison to base
file l cvs log filename Show all the previous versions number,
comitter, date and number of lines modified l cvs diff filename
Show lines where there are differences between local and base file
l cvs annotate filename Gives information line by line: version of
introduction, who, when
Slide 35
Sophia Antipolis Status examples
Slide 36
Sophia Antipolis Log examples
Slide 37
Sophia Antipolis Diff examples
Slide 38
Sophia Antipolis Annotate examples
Slide 39
Sophia Antipolis Tagging l Tag = string marker which is applied
to the status of a part of the CVS hierarchy l Often used to mark a
given version of the cvs repository with a string which refers to a
version of the software released l Easily get back specific
versions of the software Use/distribute a given released version
Reproduce bugs for a given release version l Only files are tagged
l cvs tag r 1.2 tagname files cvs rtag tagname files (latest
version in the base is tagged)
Slide 40
Sophia Antipolis Add, delete, and move files l cvs add
filenames l Produces a message that explains that a commit is
necessary l cvs commit -m addition of files bla directories/files
Files have to be locally deleted: rm filenames Produces a message
that explains that a commit is necessary l cvs remove filenames l
cvs commit -m removed files bla directories/files l Trace of
deleted files in Attic directories on the CVS base l Move = add +
delete, with an explicit message to keep a trace of the old
names
Slide 41
Sophia Antipolis Add, delete, and move folders l As simple as
files for addition; do not need a commit command to take effect l
Not possible to delete and/or move folders! Except with hard
intervention, cf. advanced use of CVS section
Slide 42
Sophia Antipolis Summary of the main commands cvs [cvs-options]
command [cmd-options] [directories/files] cvs importimport files
from a local directory to the cvs base cvs checkoutcopy on a local
disk a given version of the cvs base cvs commitapply the
modifications of the local copy to the cvs base cvs updateupgrade
the local copy with a version of the cvs base cvs addadd a file to
the cvs base cvs removeremove a file from the cvs base cvs
statusshow the status of a local file wrt the cvs base cvs logshow
the different previous commit stages cvs diffshow lines in local
and server files that differ cvs annotateshow information line by
line of a version in the cvs base cvs tag (or rtag)put a tag to
identify a given version of the cvs base
Slide 43
Sophia Antipolis Overview l Collaborative work and version
control l Main CVS user commands l Advanced use of CVS l CVS server
at INRIA Sophia Antipolis
Slide 44
Sophia Antipolis CVS Administration l Modules administration l
Usage definition Events control (emails, ) Watch/edit
Slide 45
Sophia Antipolis CVS base configuration l CVSROOT Module
(exists by default) cvs checkout CVSROOT l Configuration files
modules, modules definitions cvswrapper binary files control
cvsignore list which files CVS has to ignore (*.o, ) commitinfo,
editinfo, loginfo, notify, rcsinfo, taginfo make it possible to
configure actions with respect to specific CVS operations
Slide 46
Sophia Antipolis Binary files in CVS base l No real version
control (diffs dont work) l Binaries are corrupted if treated as
ASCII files Can be done with command line: cvs add kb filename l
Can be forced for known extensions Configuration file:
cvswrapper
Slide 47
Sophia Antipolis Configuration file for binary extensions:
examples
Slide 48
Sophia Antipolis Recursion with CVS l Check each command to see
if it is recursive or not Add is not recursive, update is
recursive, l Read the cvs manual (note we are in the advanced
section of the expose)
Slide 49
Sophia Antipolis Windows users l Several CVS clients: webCVS,
winCVS, l Possible use of CVS with ssh under Windows via putty
(Windows ssh client) contact me l Problems with line ending always
edit files on the platform where the checkout has been done!
Slide 50
Sophia Antipolis Branching l Branching is easy merging is not!
l When ? Before a release (freeze the code in a branch) For
parallel development that will not be integrated directly For
someone developing during a training period For some research code
For a specific application (e.g. dedicated to a given client) 1.1
1.2 1.3 1.2.2.1 1.2.2.2 1.2.2.3 1.2.2.4 1.2.2.2.2.1
Slide 51
Sophia Antipolis Direct manipulations on the server l To
restructure a repository (e.g. move or delete folders) l To check
for possible problems l For instance, administrators of a CVS
repository at Sophia can connect to the server via ssh: ssh
cvs-sop.inria.fr cd /CVS/SmartTools
Slide 52
Sophia Antipolis Overview l Collaborative work and version
control l Main CVS user commands l Advanced use of CVS l CVS server
at INRIA Sophia Antipolis
Slide 53
Sophia Antipolis Admistrated by the semir l Semir page about
the INRIA cvs server: http://www-sop.inria.fr/semir/serveurs/cvs/ l
Hotline SEMIR to open a new repository:
http://www-sop.inria.fr/semir/support/ Logiciels/Outils then
Agenda, CVS, FTP, MYSQL Chose CVS and Creation
Slide 54
Sophia Antipolis ssh access l Good level of security for the
authentication l http://www-sop.inria.fr/semir/serveurs/cvs
http://www-sop.inria.fr/semir/serveurs/cvs l In actual using, only
few differences: cvs -d :ext:[email protected]:/CVS/dream
checkout web
Slide 55
Sophia Antipolis Administrative tasks l Standard CVS
administration (cf. CVSROOT Module) l Admin module automatically in
the repository when created by the SEMIR 3 files: group-def,
modules-def, passwd-def l group-def: define and describe groups of
users l modules-def: define access rights for each module wrt
groups (ssh, anonymous) l passwd-def: define and describe accounts
(username, crypted password and email ) for non INRIA users
Slide 56
Sophia Antipolis References and links l CVS:
https://www.cvshome.org/https://www.cvshome.org/
https://www.cvshome.org/docs/manual/
https://ccvs.cvshome.org/fom/fom.cgi l GUI:
http://www.twobarleycorns.net/tkcvs.html http://www.wincvs.org
http://www.tortoisecvs.org http://www.jalindi.com/igloo
http://www.jcvs.org l INRIA server:
http://www-sop.inria.fr/semir/serveurs/cvs/http://www-sop.inria.fr/semir/serveurs/cvs/
http://www-sop.inria.fr/semir/serveurs/cvs/#p3 l CVS Configuration
et mise en uvre. Frdric Lepied. OReilly Eds. (available at the
documentation centre of INRIA Sophia: ref. O356 )
Slide 57
Sophia Antipolis Closing remarks & Questions l Use version
control systems from the start When working alone or in a group For
development projects or scientific papers When tag released
versions l Handy FAQs on the CVS home site Next seminar is next
year! January 13th on Refactoring