Top Banner
Version Control Systems and the Subversion Kloimstein Dominik
36

Version Control Systems and the Subversion

Feb 22, 2016

Download

Documents

senona

Version Control Systems and the Subversion . Kloimstein Dominik. Overview. Basic information about VCS/Subversion Standard commands of Subversion Branching and Merging. What is a Version Control System?. Standard software update process - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Version Control Systems  and the  Subversion

Version Control Systems and the Subversion

Kloimstein Dominik

Page 2: Version Control Systems  and the  Subversion

Overview

• Basic information about VCS/Subversion

• Standard commands of Subversion

• Branching and Merging

Page 3: Version Control Systems  and the  Subversion

What is a Version Control System?

Software xyzVersion 2.0.12

• Standard software update process

• In general version 2.0.11 is deleted – use 2.0.12

Page 4: Version Control Systems  and the  Subversion

What is a Version Control System?

• Same update process with arbitrary files

• Also first textfile will be overriden

Textfile xLast change: 10.12.2010

Textfile xLast change: 10.10.2010

Page 5: Version Control Systems  and the  Subversion

What is a Version Control System?

Textfile xLast change: 10.12.2010

Textfile xLast change: 10.10.2010

User A

Page 6: Version Control Systems  and the  Subversion

What is a Version Control System?

• Manages all versions of files or directories in the system

• Subversion is a open source VCS

Page 7: Version Control Systems  and the  Subversion

What are Revisions?

• Are like version numbers of files or directories

• Each change of a file increases the revision number by 1

• Subversion gives the whole filesystem a number

• Such a filesystem tree is called repository

Page 8: Version Control Systems  and the  Subversion

What are Revisions?

Page 9: Version Control Systems  and the  Subversion

File sharing problem

Page 10: Version Control Systems  and the  Subversion

File sharing problem

• Lock-modify-unlock solution

Page 11: Version Control Systems  and the  Subversion

File sharing problem

• Problems are:– Administration (enough rights to lock)– Performance (one user must wait)– False sense of security• Harry works on File A• Sally works on File B• A and B are depend on each other

Page 12: Version Control Systems  and the  Subversion

File sharing problem

• Copy-modify-merge solution

Page 13: Version Control Systems  and the  Subversion

File sharing problem

• Copy-modify-merge solution

Page 14: Version Control Systems  and the  Subversion

File sharing problem

• Subversion use the copy-modify-merge method• No waiting• Problem of so called conflicts– Same problem with different results– Overlaping of changes– Solution: Communication (direct talk or put a flag)

• Subversion can also lock files– Necessary for sound or graphic files

Page 15: Version Control Systems  and the  Subversion

Repository

Page 16: Version Control Systems  and the  Subversion

How to work with Subversion

• svn [command] [URL]– $ svn checkout http://svn.example.com/repos/calc

• URL-forms:– file:/// - direct local access– http:// - access to a Apache server– https:// - same as http with SSL encryption– svn:// -access to a Subversion server– svn+ssh:// - same as svn through SSH tunnel

Page 17: Version Control Systems  and the  Subversion

How to work with Subversion

• file:///C:/svn/repos• file:///svn/repos• file:///localhost/svn/repos

• http://svn.example.com/repos• http://svn.example.com:9834/repos

Page 18: Version Control Systems  and the  Subversion

Commands

• The most often used commands are:– svn add URL– svn delete URL– svn copy URL1 URL2– svn move URL1 URL2– svn mkdir URL

Page 19: Version Control Systems  and the  Subversion

Commands

• checkout – copy files to the local working directory

$ svn checkout http://svn.example.com/repos/calcA calc/MakefileA calc/integer.cA calc/button.cChecked out revision 1.

Page 20: Version Control Systems  and the  Subversion

Commands

• commit – submit one or several files to the server

$ svn commit button.c Sending button.cTransmitting file data .Committed revision 57.

• Command commit maybe don‘t change files – solution command update

Page 21: Version Control Systems  and the  Subversion

Commands

• update – submit the whole working directory to the server

$ svn updateUpdating '.':U button.cUpdated to revision 58.

Page 22: Version Control Systems  and the  Subversion

Commands

• import – import a file or directory to the repository

$ svn import /path/to/mytree \http://svn.example.com/repo/some/projectAdding mytree/foo.cAdding mytree/bar.cAdding mytree/subdirAdding mytree/subdir/quux.hCommitted revision 59.

Page 23: Version Control Systems  and the  Subversion

Commands

• list – show files in the given directory$ svn list http://svn.example.com/repo/some/projectbar.cfoo.csubdir/

Page 24: Version Control Systems  and the  Subversion

Commands

• status – show a overview of all changes– ? item – This item is not under version control– A item – Scheduled for addition to the repository– D item – Scheduled for deleting this item in the

repository– M item – The content in item is modified

$ svn status? scratch.cA stuff/lootA stuff/loot/new.cD stuff/old.cM bar.c

Page 25: Version Control Systems  and the  Subversion

Commands$ svn status stuff/fish.cD stuff/fish.c

$ svn status -vM 44 23 sally README 44 30 sally INSTALLM 44 20 harry bar.c 44 18 ira stuff 44 35 harry stuff/trout.cD 44 19 ira stuff/fish.c 44 21 sally stuff/thingsA 0 ? ? stuff/things/bloo.h 44 36 harry stuff/things/gloo.c

Page 26: Version Control Systems  and the  Subversion

Commands• diff – show a overview of all changes in detail

$ svn diffIndex: bar.c===================================================================--- bar.c (revision 3)+++ bar.c (working copy)+#include <sys/types.h>+#include <sys/stat.h>+#include <unistd.h>++#include <stdio.h>int main(void) {- printf("Sixty-four slices of American Cheese...\n");+ printf("Sixty-five slices of American Cheese...\n");return 0;}Index: README...

Page 27: Version Control Systems  and the  Subversion

Commands

• log – show a time based overview of all changes in detail

$ svn log------------------------------------------------------------------------r3 | sally | 2008-05-15 23:09:28 -0500 (Thu, 15 May 2008) | 1 lineAdded include lines and corrected # of cheese slices.------------------------------------------------------------------------r2 | harry | 2008-05-14 18:43:15 -0500 (Wed, 14 May 2008) | 1 lineAdded main() methods.------------------------------------------------------------------------r1 | sally | 2008-05-10 19:50:31 -0500 (Sat, 10 May 2008) | 1 lineInitial import------------------------------------------------------------------------

Page 28: Version Control Systems  and the  Subversion

Commands

$ svn log -r 8 -v------------------------------------------------------------------------r8 | sally | 2008-05-21 13:19:25 -0500 (Wed, 21 May 2008) | 1 lineChanged paths:M /trunk/code/foo.cM /trunk/code/bar.hA /trunk/code/doc/READMEFrozzled the sub-space winch.------------------------------------------------------------------------

Page 29: Version Control Systems  and the  Subversion

Commands

• cat – return the content of a file$ cat sandwich.txtTop piece of breadSalamiMortadellaProsciutto

Page 30: Version Control Systems  and the  Subversion

Commands• revert – delete changes and start from the beginning

$ cat sandwich.txtTop piece of breadSalamiMortadellaProsciutto

Now change Salami to Salad.

$ cat sandwich.txtTop piece of breadSaladMortadellaProsciutto

$ svn revert sandwich.txtReverted 'sandwich.txt‘

$ cat sandwich.txtTop piece of breadSalamiMortadellaProsciutto

Page 31: Version Control Systems  and the  Subversion

Commands

$ svn cat -r 2 sandwich.txtTop piece of breadSaladMortadellaProsciutto

Page 32: Version Control Systems  and the  Subversion

Branching and Merging

• Trunc – is the main directory• Branch – is a copy of a file or directory of the

trunc section with small differences• Tag – is a kind of „snapshot“ of a revision• Merge – is the combining of two branches (or

to combine the branch back with the trunc)

Page 33: Version Control Systems  and the  Subversion

Branching and Merging

Page 34: Version Control Systems  and the  Subversion

Branching and Merging

• Tag – example$ svn copy http://svn.example.com/repos/calc/trunk \http://svn.example.com/repos/calc/tags/release-1.0 \Committed revision 902.

Page 35: Version Control Systems  and the  Subversion

Branching and Merging

• Merge – example$ svn merge --reintegrate ^/calc/branches/my-calc-branch--- Merging differences between repository URLs into '.':U button.cU integer.cU Makefile--- Recording mergeinfo for merge between repository URLs into '.':U .

$ svn commit -m "Merge my-calc-branch back into trunk!"Sending .Sending button.cSending integer.cSending MakefileTransmitting file data ..Committed revision 391.

Page 36: Version Control Systems  and the  Subversion

Branching and Merging

# Which changes have already been merged from trunk to branch?$ svn mergeinfo ^/calc/trunkr341r342r343…r388r389r390# Which changes are still eligible to merge from trunk to branch?$ svn mergeinfo ^/calc/trunk --show-revs eligibler391r392r393r394r395$