Subversion Source Code Management System - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Subversion Source Code Management System

Description:

Functional replacement for CVS. Directory versioning (renames and moves) ... D ./stuff/hest.pl [this file is scheduled for deletion] ... – PowerPoint PPT presentation

Number of Views:254
Avg rating:3.0/5.0
Slides: 24
Provided by: blair1
Category:

less

Transcript and Presenter's Notes

Title: Subversion Source Code Management System


1
Subversion Source Code Management System
  • Michael Legart / cph.pm
  • Based on presentation by
  • Blair Zajac

2
Why Use Subversion?
  • Functional replacement for CVS
  • Directory versioning (renames and moves)
  • Atomic commits (all or nothing)
  • File directory meta-data
  • Requires less network access

3
Subversion Client Side
  • Each working directory has a .svn directory
  • Similar to CVSs CVS directory
  • Repository password stored in each .svn (you can
    choose not to)
  • Stores a copy of each file in a directory

4
Subversion Architecture
  • Two locations of SVN repositories
  • On a local filesystem
  • Typically used for a single developer
  • Accessed via direct file read/write access
  • Requires that users have local accounts
  • Uses filesystem and user/group security
  • On a remote system
  • Accessed via a HTTP or HTTPS connection
  • Does not require that users have accounts on the
    server
  • Use Apache style authentication

5
Subversion Server Design
  • Server uses Apache web server
  • Browse repository with Mozilla (or any other
    browser)
  • With mod_deflate, compression can be used between
    client and server
  • Repository uses Berkeley Database
  • Data integrity
  • Atomic writes
  • Recoverability
  • Hot backups (with logfiles like in Oracle)

6
Subversion Command Line Differences
  • CVS
  • Argument position matters
  • cvs d /cvsroot update d
  • SVN
  • Argument position does not matter
  • svn log r 123 foo.pl
  • svn log foo.pl r 123

7
Revisions (Part 1)
  • Revision numbers are applied to an object to
    identify a unique version of that object
  • Example files
  • ls
  • bar.pl foo.pl
  • CVS
  • Revision numbers are per file
  • A revision number from one file does not
    necessarily have any meaning to another file
    with the same revision number
  • A commit only updates the revision numbers of
    files that were modified
  • bar.pl may be at revision 1.2 and foo.pl at 1.10
  • Updates to bar.pl will not change foo.pls
    revision number

8
Revisions (Part 2)
  • Subversion
  • Revision numbers are global across the whole
    repository
  • Identify how the entire repository looks at that
    instant in time
  • A commit creates a snapshot of the entire tree in
    the repository at that revision number
  • Allows users to say, Hey so-and-so, go get
    revision 1432 of XYZ and try to compile it.
  • Before an update, both bar.pl and foo.pl are at
    revision 25
  • Modify bar.pl and commit
  • Then update the working copy
  • Now bar.pl and foo.pl are at revision 26, except
    that foo.pl in revision 25 and 26 are identical
  • No additional space in repository required, i.e.
    a cheap copy or a symbolic link is made

9
Basic Work Cycle (Part 1)
  • Checkout a working copy
  • Update working copy
  • Make changes
  • Examine your changes
  • Merge others changes
  • Commit your changes

10
Basic Work Cycle (Part 2)
  • Checkout a working copy
  • svn co http//svn.collab.net/repos/svn
  • cd svn/doc
  • Update working copy
  • Update all files and directories to the most
    current version
  • svn update
  • Go to a particular older revision for all files
    and directories
  • svn update r 1345
  • I want an even older version of svn-doc.el
  • svn update r 999 svn-doc.el
  • Update output
  • U foo'
  • File foo' was (U)pdated (received changes from
    the server.)
  • A foo'
  • File or directory foo' was (A)dded to your
    working copy.
  • D foo'
  • File or directory foo' was (D)eleted from your
    working copy.
  • R foo'
  • File or directory foo' was (R)eplaced in your
    working copy that is, foo' was deleted, and a
    new item with the same name was added. While
    they may have the same name, the repository
    considers them to be distinct objects with
    distinct histories.

11
Basic Work Cycle (Part 3)
  • Make changes
  • Add new files and directories
  • vim Simple.pm
  • mkdir Presentation
  • touch Presentation/Othermodule.pm
  • svn add Presentation Presenation/Simple.pm
  • Presentation/Othermodule not added unless R
    passed to svn add
  • Delete files
  • svn rm foo somescript.pl (No need to delete
    file first)
  • Rename file
  • svn mv README.txt README_OLD.txt
  • Copy files and directories
  • svn cp test_datafiles test_datafiles_new
  • works for directories too

12
Basic Work Cycle (Part 4)
  • Examine your changes
  • svn status Normal amount of information
  • svn status
  • _ L ./abc.pl svn has a lock in
    its .svn directory for abc.pl
  • M ./bar.pl the content in
    bar.pl has local modifications
  • _M ./baz.pl baz.pl has property
    but no content modifications
  • ? ./generatedfile svn doesn't manage
    generatedfile
  • ! ./foo.pl svn knows foo.pl
    but a non-svn program deleted it
  • A ./moved_dir added with history
    of where it came from
  • M ./moved_dir/README added with history
    and has local modifications
  • D ./stuff/hest.pl this file is
    scheduled for deletion
  • A ./stuff/newfile.pl this file is
    scheduled for addition
  • svn status Even more info with v
  • Show revision numbers
  • Show who changed the files

13
Basic Work Cycle (Part 5)
  • Examine your changes
  • svn diff Show your modifications
  • Even shows modifications in properties
  • Show all differences in files and directories in
    local working copy
  • svn diff
  • Diff between revision 3 of foo.pl in repository
    and local working foo.pl
  • svn diff r 3 foo.pl
  • Diff between revisions 2 and 3 of foo.pl in the
    repository without even touching local foo.pl
  • svn diff r 23 foo.pl
  • Revert all your changes
  • Does not require network access
  • svn revert
  • Commit your changes
  • Generate a log message containing the files and
    directories that have been modified
  • svn commit

14
Conflict Resolution
  • Look for the C when you run svn update
  • Better than CVS
  • Conflict markers are placed into the file, to
    visibly demonstrate the overlapping areas. Just
    like in CVS.
  • Three fulltext files starting with tmp' are
    created these files are the original three files
    that could not be merged together. This is
    better than CVS, because it allows users to
    directly examine all three files, and even use
    3rd-party merge tools (as an alternative to
    conflict markers.)
  • Another improvement over CVS conflict handling
    Subversion will not allow you to "accidentally"
    commit conflict markers, as so often happens in
    CVS. Unlike CVS, Subversion remembers that a
    file remains in conflict, and requires definite
    action from the user to undo this state before it
    will allow the item to be committed again.
  • Solutions to resolve
  • Hand-merge the conflicted text
  • Copy one of the tmpfiles on top of your working
    file
  • Run svn revert to toss all of your changes
  • Once resolved, you need to tell SVN that the
    conflict has been resolve
  • Run svn resolve
  • This deletes the tmp files

15
Log Messages (Part 1)
  • Log messages are not embedded in files, like CVS
  • Messages are associated with a single commit
  • Possible to change log message after commit
  • View log messages with svn log command

16
Log Messages (Part 2)
  • See all log messages
  • svn log
  • --------------------------------------------------
    ----------------------
  • rev 3 mil Sun, 29 Sep 2002 180346 1 line
  • Changed bla bla
  • --------------------------------------------------
    ----------------------
  • rev 2 mil Sun, 29 Sep 2002 174757 1 line
  • Added bla bla.
  • --------------------------------------------------
    ----------------------
  • rev 1 mil Sun, 29 Sep 2002 174008 2 lines
  • Initial import
  • --------------------------------------------------
    ----------------------
  • Limit the range of log messages
  • svn log -r 519
  • ... shows logs 5 through 19 in chronological
    order
  • svn log -r 195

17
File Directory Properties (Part 1)
  • Each files and directory has associated with it a
    hash of properties
  • Store any information in the hash
  • Subversion uses hash key names prefixed with svn
    for its own use
  • In these examples, svnXXX is a hash key name, it
    is not a hash key and value pair
  • Listing properties
  • svn proplist README.txt
  • Properties on README.txt'
  • svneol-style
  • Getting property value
  • svn propget svneol-style README.txt
  • native

18
File Directory Properties (Part 2)
  • Setting a property via the command line
  • For simple properties, just use the command line
    interface
  • svn propset svneol-style CRLF README.txt
  • property svneol-style' set on README.txt'
  • Setting a property via the editor
  • For complicated values, such as the list of files
    and subdirectories to ignore which contain a list
    across multiple lines, load the values into an
    editor
  • svn propedit svnignore .
  • Set new value for property svnignore' on .'

19
Subversion Specific Properties (Part 1)
  • svnexecutable
  • For files only, sets the executable bit
  • Useful for scripts and programs
  • The executable bit is set when the property is
    applied to the file, not when the commit is
    performed
  • The executable bit is removed when this property
    is removed from the file
  • The property value does not matter, any value
    will do
  • svnmime-type
  • SVN assumes a text file if svnmime-type is not
    set or is set and matches text/, otherwise it
    is a binary file
  • If a file is a text file, SVN can use diff and
    patch to update changes from the repository

20
Subversion Specific Properties (Part 2)
  • svnignore
  • For directories only
  • Same syntax as MANIFEST.SKIP etc
  • Tells SVN which files and subdirectories to
    ignore
  • Equivalent to CVSs .cvsignore file
  • svnkeywords
  • Keyword substitution in files
  • The only available keyword substitutions are
    LastChangedDate, LastChangedRevision,
    LastChangedBy and HeadURL
  • Only the keywords listed in the svnkeywords
    property value are replaced in the file
  • LastChangedDate 2002-07-22 214237 -0700 (Mon,
    22 Jul 2002)
  • LastChangedRevision 144
  • LastChangedBy joe
  • HeadURL http//svn.collab.net/repos/trunk/README

21
Subversion Specific Properties (Part 3)
  • svneol-style
  • How to handle end of line differences.
  • Property not set, this is the default when a file
    is added
  • Do not change end of lines upon check in or
    update
  • Native
  • Convert all CR, CRLF and LFs to the systems
    native eol
  • CR
  • Convert all CRLF and LFs to CRs
  • CRLF
  • Convert all CR and LFs to CRLFs
  • LF
  • Convert all CR and CRLFs to LFs

22
Tags and branches
  • Developer copies trunk to a new branch and notes
    revision of trunk
  • svn cp m Creating branch for working on
    blabla \
  • http//svn.company.com/svn/trunk/product \
  • http//svn.company.com/svn/branches/USERNAME-work
    ing-on-this
  • svn log -v http//svn.company.com/svn/branches/U
    SERNAME-working-on-this
  • Prints revision number, say 123
  • svn co http//svn.company.com/svn/branches/USERN
    AME-working-on-this
  • Make changes
  • Time to merge work into trunk
  • But first, merge trunk changes to branch
  • svn merge r 123HEAD http//svn.company.com/svn
    /trunk/product .
  • Test new code.
  • svn commit
  • Revision 256.
  • Tree admin now merge changes into trunk
  • cd /tmp
  • svn co http//svn.company.com/svn/trunk/product
  • cd product
  • svn merge . http//svn.company.com/svn/branches/
    USERNAME-working-on-this

23
For More Information
  • Subversion home
  • http//subversion.tigris.org/
  • Subversion handbook
  • http//subversion.tigris.org/files/documents/15/57
    6/svn-handbook.html
  • Subversion quick reference guide
  • http//subversion.tigris.org/files/documents/15/17
    7/foo.ps
  • Subversion document folder
  • http//subversion.tigris.org/servlets/ProjectDocum
    entList
  • Subversion project status
  • http//subversion.tigris.org/project_status.html
  • Subversion source code and binary downloads
  • http//subversion.tigris.org/servlets/ProjectDocum
    entList
Write a Comment
User Comments (0)
About PowerShow.com