Presentation is loading. Please wait.

Presentation is loading. Please wait.

/ department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e version control on.

Similar presentations


Presentation on theme: "/ department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e version control on."— Presentation transcript:

1 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e version control on files with CVS demo / discussion hour HG 6.29 Nov 19, 2003 Reinier Post

2 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e CVS – Concurrent Versions System CVS is software for version control on directory trees with files. http://www.cvshome.org/

3 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e version control on files Multiple versions of a file: for example a document you’re editing + a backup copy your document at home + a copy at work your version of a document + Harry’s version a copy of a webpage + the version you modified with your suggestions

4 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e version control on whole directory trees Multiple versions of directory trees full of files: a website a LaTeX document (single author or co-authored) the source code of a computer program a user software profile (config files, startup scripts, utilities)

5 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e demo 0: find some examples locate.oud; locate.old locate /home | grep -v '[~%v]$' | ~rp/bin/previsprefix most files are completely redundant - not worth saving! local copies of available files copied from elsewhere files generated by programs from other files temporary backup copies different versions of the same file: only partially redundant => version control problem: what to save, when, and where?

6 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e demo 1: diffdiff locatelocate /home/rp | grep -v '[~%v]$' | fgrep -v rpsoft | previsprefixgrepfgrepprevisprefix diff diff –u diff –r diff is a standard Unix tool (since the 70s) only useful on plain text files, including structured plaintext (source code, XML, etc.) if formatted uniformly

7 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e demo 2: patch diff –u diff –u a a.modified > a.diff rmrm a.modified patchpatch < a.diff # turns a into a.modified ! patch is a standard Unix tool (since the late 80s)since the late 80s only applicable when you can work with diffs allows “merging” different changes into single result

8 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e RCSRCS: version control on a file let user explicitly commit versions of a file remember all versions the user doesn’t remove be “clever”: save the diffs! every version has a number every version has an (optional) log message RCS can record info about the version in the file written in 1985, soon very popularwritten in 1985

9 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e demo 3: RCS locate /home/rp | grep RCS # on win.tue.nl Solaris/Linux # examine a,v file, you’ll see they are diffs main RCS commands: ci file# check current version of file in to file,v co file# check latest version of file out from file,v rcsdiff file# diff file with latest version in file,v

10 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e the power of RCS On a file in RCS you can ask questions like: is this copy the latest “good” version? to which “good” version (created when) does this copy correspond, if any? what are the diffs between June 1 st and today? is the copy I mailed to Harry older or newer than the copy on the website?

11 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e version control with RCS: properties working copy vs. repository the repository (file,v) holds versions of the working copy, but is not a working copy itself no automatic “tracking” of changes in working copies; the user is trusted to check versions in and out as appropriate this can lead to conflicts if multiple working copies are edited

12 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e limitations of RCS; CVS only works on single files single host: ci / co work on “local” file system => CVS (written in 1986 on top of RCS) =>written in 1986 on top of RCS RCS on a whole directory tree of files at once many extra features repositories can be remote (client/server) nice GUI clients and repository browsers availableGUI clients repository browsers

13 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e demo 4: CVS for private use cd ~/bin; cvs log main CVS commands: cvs ci file # check current version of file in to $CVSROOT cvs co file # check latest version of file out from $CVSROOT cvs up file # id., if a copy is already available cvs add file # put a file under version control in $CVSROOT cvs diff file # compare current copy of file with latest in $CVSROOT file can be a whole directory tree, $CVSROOT can be remote

14 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e demo 4 (continued) cd /tmp cvs –d /home/rp/cvs co scripts cd scripts rightperl rightperl bin/* cvs diff # on a different host: cd /tmp cvs –d :ext:rp@svis02.win.tue.nl:/home/rp co scripts # via ssh!

15 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e demo 5: the Tortoise CVS clientthe Tortoise CVS client a (free) GUI CVS client for Windows easier to use than the command line, but everything works the same way: right-click to get the initial menu, select CVS Checkout...right-click to get the initial menu, select CVS Checkout select the repository and communication method,select the repository and communication method inside the resulting directory you can CVS update and check in

16 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e demo 6: CVS for collaboration co-authoring papers: one author hosts the CVS repository gives other author(s) read/write access to it software development projects: (demo) petriweb.org: website, software & docs in CVS checked out automatically (using a CVSROOT/ feature)CVSROOT/

17 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e authentication for remote CVS servers with the :pserver: protocol: - the CVS server runs as one OS user - user accounts are managed in the CVS server - good for read-only access; too insecure for read-write access with :ext: (ssh): - with one CVS server user, slightly better than pserver - with arbitrary repositories for arbitrary groups of people, it requires a lot of account administration (SourceForge: every user can get a Unix account by registering)

18 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e demo 7: public CVS SourceForge ( http://sf.net/ ): over 70,000 CVS repositorieshttp://sf.net/ (pick one for a demo); mostly software development. Most of the world’s CVS repositories are elsewhere.

19 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e the power of CVS CVS allows to set up a single repository for all files in a project, with full version control. you always know where your “good” versions are and how they are related multi-user Internet wide (largely) platform independent (on MS Windows you can feel the Unix legacy)

20 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e CVS: properties working copy vs. repository the repository holds versions of the working copy, but is not a working copy itself no automatic “tracking” of changes; every user must check in and check out regularly; this can lead to conflicts if multiple working copies are edited this can lead to conflicts if multiple working copies are edited

21 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e CVS administrative files In the working copy: every directory has a subdirectory CVS/ with files used by CVS the file.cvsignore can be used to tell CVS to ignore files in the working copy that must not be in the repository.cvsignore In the repository: the CVSROOT/ directory contains many files with interesting configurable settingswith interesting configurable settings

22 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e CVS caveats cvs add only prepares to add files, you need to confirm with cvs ci, and on a directory follow that again with cvs up files can be explicitly marked as binary (see the manual) cvs can cope with the difference between Unix and Windows, but if files seem corrupted, check the CVS client settings If you have many conflicts (a working copy has been edited while a new repository version was added from another source) you need to talk to people, not to CVS.

23 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e advanced CVS commands creating a repository: cvs init, cvs import branching: cvs tag file # label current version of file in $CVSROOT cvs rtag # label current versions in $CVSROOT this can be used to create branches, forks of the code cvs merge args # join two branches together (equiv. of patch) cvs edit, cvs editors, cvs watch, etc.: for change notification

24 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e CVS: strong points entirely free: no cost, no licensing everybody and their dog uses it: high reliability, good support via Google simple: config files are plaintext, the protocol is simple, source code is free, so it’s very transparent extensible: it’s easy to wrap stuff around CVS at client side and server side (e.g. automatic checkout for petriweb.org: CVSROOT/loginfo calls this script) petriweb.orgCVSROOT/loginfoscript

25 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e CVS: weak points overly simple: it works on whole directory trees, but - adding/removing files and dirs is confusing - renaming files isn’t supported (except remove + add) - committing multiple files isn’t atomic - no support for hardlinks / symlinks / shortcuts - tagging/branching whole trees is hard to do the use of diffs: - performance on binary files is terrible - performance decreases with the number of commits

26 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e when to use CVS CVS is good when you have a collection of (mostly) text files you change them or plan to change them regularly (at least your copies of them) you and/or others access them from various locations you want to explicitly record and recall “good” versions of the files

27 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e CVS only offers version control! It does not offer: a website for your project a meeting place / q&a facility for users/authors problem report / task scheduling facilities etc. See again SourceForge for a survey of other facilities required to support a project.SourceForge

28 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e alternatives to CVS no version control: only if you’re sure you’ll only ever need the latest version SCCS (standard on Sun Solaris): not popular enough Subversion and others want to be CVS-like systems that fix its worst problems. I haven’t tried them.Subversion its worst problems Microsoft Visual SourceSafe. I haven’t tried it.Microsoft Visual SourceSafe more?

29 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e CVS vs. filesystem backups/copies a filesystem copy / backup to another disk or tape: saves everything indiscriminately may or may not save it in a useable state has limited memory for older versions a CVS repository: makes the user decide when to save what expects selective use (not too many files or saves) keeps perfect memory of everything ever saved

30 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e where to go next To learn how to use CVS: you don’t need to know much more than this good manuals are on the Web it takes a few hours to get used to

31 / department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e CVS @ W&I Is there any need for a departmental CVS server for 1-user projects? (I don’t think so) for collaborations within the dept.? (?) for collaborations with others? (useful, but I don’t see how to set it up) as a public server for material? (?) ? Other kinds of CVS support? (Training?)


Download ppt "/ department of mathematics and computer sciencedepartment of mathematics and computer science technische universiteit eindhoven TU/e version control on."

Similar presentations


Ads by Google