Version Control - University of Calgary

Version Control - University of Calgary

Version Control Systems SENG 403 Tutorial 1 SENG 403 Winter 2012 1 Agenda Version Control Basics Subversion

Basic actions in Subversion Some examples SENG 403 Winter 2012 2 Version Control Basics A version (or revision) control system is able to track incremental versions of files and

directories over time The core of a version control system is a repository SENG 403 Winter 2012 3 Version Control Server The version control server does not work just

like a typical file server. The repository remembers each version of files, as they are changed in the repository. When a client reads from the repository, it normally gets the latest version. But it can request the previous states of the file system. Working copy: A local copy of a particular version of a VCS-managed data. SENG 403 Winter 2012

4 The Main Reasons to Have a VCS To track the various versions of digital information over time To enable collaborating editing and sharing of data We want sharing but we want to avoid accidentally stepping on each others toes.

SENG 403 Winter 2012 5 A Typical Problem SENG 403 Winter 2012 6

Solution 1:Lock-Modify-Unlock SENG 403 Winter 2012 7 Solution 2: Copy-Modify-Merge SENG 403 Winter 2012 8

Solution 2 (continued) SENG 403 Winter 2012 9 Subversion Repository Subversion clients commit in an atomic fashion.

After each successful commit, a new state of filesystem tree will be created. It is called a revision. SENG 403 Winter 2012 10 Subversion Working Copies A working copy is a directory on your local

machine, containing a collection of files. When you finish making changes, you tell the Subversion client to publish it, so that other people can see the changes. To manage merges and conflicts, Subversion keeps track of the revision that your working copy is based on and a timestamp recording when the local copy was last updated by the repository. SENG 403 Winter 2012

11 Some VCS Terms Repository (repo) Trunk/Main Add Revision Head Check out Check in

Changelog/History Update/Sync Revert Branch Merge Conflict Resolve Diff/Change/Delta SENG 403 Winter 2012 12

SVN Server We need a SVN server to put all the revisions of the project(s) on it. One option is to use free source code repository web sites, like SourceForge and CodePlex. In this tutorial we will use CodePlex. CodePlex supports SVN as well as MS TFS. You can define a project and use the VCS Server of the CodePlex.

Warning: Unless you make the project public within a month, it will be removed after 30 days. SENG 403 Winter 2012 13 Addressing the Repository Subversion client programs use URLs to identify versioned files and directories in Subversion repositories.

For the most part, these URLs use the standard syntax, allowing for server names and port numbers to be specified as part of the URL: list.txt SENG 403 Winter 2012 14

SVN Client On Linux/Unix based operating systems, there is a command line SVN Client, called svn. On Windows, you can install GUI clients. TortoiseSVN is a free SVN client. When you install it, it will be integrated into Windows Explorer pop-up menu. SENG 403 Winter 2012

15 Checkins SENG 403 Winter 2012 16 Example Creating a Working Copy

SENG 403 Winter 2012 17 Checkouts and Editing SENG 403 Winter 2012 18 Example - Commit

SENG 403 Winter 2012 19 Basic Diffs SENG 403 Winter 2012 20

Example Diff Viewer SENG 403 Winter 2012 21 Conflicts SENG 403 Winter 2012 22

Conflicts - Example Create two working copies of the project Add different items at the end of list.txt. Commit the file from the first working copy. Try to commit the second copy. You will get an error. SENG 403 Winter 2012

23 Conflicts Example (continued) To see the conflicts, choose SVN update from the pop-up menu, on the second working copy. It will put conflicts inside the file, and also create three more files. The conflicting area inside the file in question is marked like this <<<<<<< filename

your changes ======= code merged from repository >>>>>>> revision SENG 403 Winter 2012 24 Conflicts Example (continued) Three additional files are: filename.ext.mine

This is your file as it existed in your working copy before you updated your working copy - that is, without conflict markers. filename.ext.rOLDREV This is the file that was the BASE revision before you updated your working copy. That is, it the file that you checked out before you made your latest edits.

filename.ext.rNEWREV This is the file that your Subversion client just received from the server when you updated your working copy. This file corresponds to the HEAD revision of the repository. SENG 403 Winter 2012 25 Conflicts Example (continued) Open the conflict editor by choosing Edit

conflicts from the menu. You should decide what the code should look like, do the necessary changes and save the file. Afterwards execute the command TortoiseSVN Resolved and commit your modifications to the repository. SENG 403 Winter 2012

26 Repository Structure There is no predefined way to organize stuff in the repository. A best practice is to use a structure like this: trunk branches/branch1 branches/branch2 ...

tags/tag1 tags/tag2 ... SENG 403 Winter 2012 27 Tagging SENG 403 Winter 2012

28 Tagging - Example Select the folder in your working copy which you want to copy to a branch or tag, then select the command TortoiseSVN

Branch/Tag.... You should change the to URL value to a new path for the tag. SENG 403 Winter 2012 29 Branching SENG 403 Winter 2012

30 Merging SENG 403 Winter 2012 31 Real-life example: Managing Windows Source Code

SENG 403 Winter 2012 32 References & Further Readings Subversion book TortoiseSVN Help:

release/TortoiseSVN_en/index.html A Visual Guide to Version Control: SENG 403 Winter 2012 33

Recently Viewed Presentations

  • A Whole New World of Settling Cases: Part Ii

    A Whole New World of Settling Cases: Part Ii

    Sec. 2-2301. Settlement of claims; payment.(a) In a personal injury, property damage, wrongful death, or tort action involving a claim for money damages, a release must be tendered to the plaintiff by the settling defendant within 14 days of written...
  • Nucleophilic Substitution overview  Mechanism of SN rxn: SN1

    Nucleophilic Substitution overview Mechanism of SN rxn: SN1

    Experiments showed the agreement between kinetics and stereochemistry. 7-* Extended dotted lines to represent bonds breaking and forming Transition state for SN2 Transition state symbol 7-* SN2: Potential Energy Diagram Thermodynamically controlled reaction: high activation energy and exergonic rxn. 7-*...
  • Public Relations - NA

    Public Relations - NA

    Central Nova Area Public Relations Workshop. Halifax, NS . January, 2016. ... meditation, and sharing can help us keep our minds off our discomfort." ... "A loving and inclusive attitude on the part of the leader and group member is...
  • Honest Services Fraud: A Thin Line Between Innocent

    Honest Services Fraud: A Thin Line Between Innocent

    Conrad Black Black was a publishing magnate. He controlled Hollinger International, which owned over 400 newspapers in North America. Most of them were small, community papers but a few were large and well-known, like the Chicago Sun Times.
  • Every Student Every School National Partnership

    Every Student Every School National Partnership

    Maths/numeracy. Consider using a numeracy bag that is packed by the classroom teacher at the beginning of each week. All the resources needed are in the bag. Appendix 13 provides a program of planned numeracy activities for students from K-12...
  • Estado Hiperosmolar Diabetes

    Estado Hiperosmolar Diabetes

    Potassium repletion is provided as for DKA with the. requisite monitoring as discussed. Subjects with lactic acidosis. will require aggressive bicarbonate therapy [Level 4]. Considering that thrombotic phenomena confer significant.
  • [Business Communication]

    [Business Communication]

    Bauska municipality. Activities, carried out: Workshop «Development cooperation experience and lessons learnt»wasorganised in August 2013. Participation of theGeorgian painter in an international art plein-air «Bauska summer 2013»
  • Blackboard Learn Advanced -

    Blackboard Learn Advanced - Under the Personal tab, click on the Course Services link. Enter the name of the class in the "Request a Blackboard Learn class" field and click the Submit button.