From CVS to Subversion Joachim “Joe” Feise UC Irvine, Information & Computer Sciences jfeise

22
From CVS to Subversion Joachim “Joe” Feise UC Irvine, Information & Computer Sciences http://www.feise.com/~jfeise/
  • date post

    18-Dec-2015
  • Category

    Documents

  • view

    215
  • download

    0

Transcript of From CVS to Subversion Joachim “Joe” Feise UC Irvine, Information & Computer Sciences jfeise

From CVS to Subversion

Joachim “Joe” FeiseUC Irvine, Information & Computer

Scienceshttp://www.feise.com/~jfeise/

Why Version Control?

• Avoiding accidental overwrites• History of changes

• Who changed what when? Who is to blame (or praise)?

• What was the state x days/months/… ago?

• Management tool

2

Traditional Version Control

• Lock-modify-unlock• Example systems

• RCS, SCCS, Perforce, VSS, …

• Results in serialization of access• Lock file, edit file, unlock file• Restrictive: lock prevent others from modifying file

• May cause administrative problems• Long locks cause delays• Makes collaboration harder• Manual unlocking may be necessary

• Scenario: forgetting to unlock before going on vacation

3

CVS Advantages

• Copy-modify-merge• Files are copied to a local area, and

modified there• No locking• Changes are only visible after merge

• Merge is the hard part• Automatic merge

• Only works with small changes

• Manual merge• Markers in files

• Binary files are not merged

4

Basic CVS Configuration

• Creating the archive• addgroup cvs; adduser cvs• cvs –d /path/to/repository init• Adjust owner/group, set sticky group bit• Add users to cvs group

• Importing files• Recreates existing file structure in CVS• cvs -m “initial checkin” top-directory

vendor-tag release-tag

5

CVS Network Access

• rsh• Don't use it!

• pserver• Listening on port 2401 by default• Add entry to /etc/inetd.conf• Beware: password transmitted in CLEARTEXT• Separate CVS password is possible

(CVSROOOT/passwd)

6

Secure Network CVS

• SSH• CVS_RSH=ssh; export CVS_RSH• cvs -d

:ext:[email protected]:/path/to/repository command

• User has to have shell account

• gserver, kserver• For Kerberos, Windows (SSPI)

7

Secure CVS Sandbox

• Using sendmail's smrsh• cvs wrapper does the chroot• Needs a static version of cvs

• LDFLAGS=-static ./configure –disable-client; make

• Allows multiple chrooted repositories• Details:

http://freshmeat.net/projects/idx-chrooted-ssh-cvs/

8

Secure CVS Sandbox, continued

• cvs users home directoriesmkdir -p homechown 0:0 home

• chrooted environment for each projectmkdir -p <project>/{bin,chrooted-cvs,smrsh.bin}mkdir -p <project>/chrooted-cvs/{bin,cvs,cvs-locks,dev,etc,tmp}chown 0:0 <project>/chrooted-cvs/{bin,dev,etc,tmp}chmod 1777 <project>/chrooted-cvs/tmp

• setting access rightschown cvsowner.cvs <project>/chrooted-cvs/cvschmod 770 <project>/chrooted-cvs/cvschown 0:0 <project>/chrooted-cvs/cvs-lockschmod 666 <project>/chrooted-cvs/cvs-locks

• create /dev/null (major/minor specific to Linux)mknod <project>/chrooted-cvs/dev/null c 1 3

• Create /etc/passwd and /etc/group in the chrooted environment

9

Eclipse CVS Demo

• CVS support included in base install• SSH2 support included since Eclipse

3.0

10

CVS Drawbacks

• Cleartext password• Complex chroot, ssh setup for security

• Checkin not atomic• No cross-directory locks

• Rename/Move loses history• No directory versioning• Deleted files end up in special Attic

directory• Special flags for binary files needed

11

Subversion

• Copy-modify-merge model• Like CVS

• Successor to CVS• Some of the same people• Clean, modular code

• Metadata (properties)• Name, value pairs

• Values can be files

• Versioned, too

• Easy migration path12

Subversion Advantages

• Versioned directories• Allows to recreate the exact state

• Atomic checkins• Everything is a transaction

• Rename/move maintains history

• Unified binary/text file handling

• Uses database for the archive

• Hot backup possible

• Minimizes network traffic• Pristine copy is stored locally

13

Subversion Configuration

• Creating the archive• Archive can not be on a network share

• svnadmin create /path/to/repos• svn import <project>

file:///path/to/repos/some/project

• Access through URIs• file://localhost/path/to/repos• svn://domain.com:port/path/to/repos• http://domain.com:port/path/to/repos• https://domain.com:port/path/to/repos

14

Subversion Network Access• svnserve

• Lightweight server

• Listening on port 3690 by default

• Runs as daemon or through entry to /etc/inetd.conf

• Runs as specific user

• -r option restricts operations to specific path

• CRAM-MD5 (RFC 2195) authentication challenge protocol

• Can be tunneled through SSH

• Apache 2• Port 80 is usually open

• Takes advantage of Apache's authentication modules

• Repository has to be writeable by Apache 15

Secure Subversion

• svnserve• Tunneling through SSH

• Variant of the svn: scheme• svn+ssh://domain.com:port/path/to/repos

• Apache 2• mod_svn module• Authentication through Apache

• basic, digest, ldap, ...• no shell access• SSL (https) for encryption

16

Subversion Hooks

• Triggered by repository event• Different commit stages• Post-commit hook usually used to send

emails, modify log files or make backups

• Hooks for changing special properties• Sample hook scripts provided

17

Subversion Cautions

• Permissions• Ownership and permission of the repositories• Access through multiple methods

• Umask settings• Different process owners

• e.g., nobody for Apache, users for direct access, ...

• For svn+ssh:, sticky group bit necessary

• Some clients not yet polished enough

18

CVS to Subversion

• Conversion tool: cvs2svn• http://cvs2svn.tigris.org/• Can convert branches• Handles tags

19

Eclipse Subversion Demo

• Subclipse plugin• Install via Help/Software Updates/New

Updates• http://subclipse.tigris.org/update • Requires svn command line tool• Quirk with SSL (https)

• no dialog box to accept certificate• certificate has to be accepted with

command line

20

Books

• CVS• “Cederquist”

(http://www.cvshome.org/docs/manual)• Open Source Development with CVS

(http://cvsbook.red-bean.com/)• CVS Pocket Reference • Essential CVS• …

• Subversion• Version Control with Subversion

(http://svnbook.red-bean.com/)21

Links• CVS

• http://www.cvshome.org/

• GUI clients• http://www.kde.org/apps/cervisia/ • http://www.wincvs.org/• http://www.tortoisecvs.org/

• chroot+SSH• http://freshmeat.net/projects/idx-chrooted-ssh-cvs/

• Subversion• http://subversion.tigris.org/

• GUI clients• http://rapidsvn.tigris.org/ • http://tortoisesvn.tigris.org/• http://svnup.tigris.org/

• Eclipse plugin• http://subclipse.tigris.org

22