• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Subversion User Guide
 

Subversion User Guide

on

  • 28,037 views

Subversion Beginners User Guide

Subversion Beginners User Guide

Statistics

Views

Total Views
28,037
Views on SlideShare
27,439
Embed Views
598

Actions

Likes
22
Downloads
964
Comments
3

9 Embeds 598

http://mauriziostorani.wordpress.com 538
http://www.slideshare.net 49
http://translate.googleusercontent.com 3
http://www.jeffreypucaputan.com 3
http://webcache.googleusercontent.com 1
http://webcache.googleusercontent.com 1
http://www.blogsdirectoryhub.com 1
http://feeds.feedburner.com 1
http://www.google.com.au 1
More...

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

13 of 3 previous next Post a comment

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • It's really awesome and hilarious. Extremely good Tutor to learn Subversion in detail.
    Are you sure you want to
    Your message goes here
    Processing…
  • Chào Bạn

    Bên mình hiện cung cấp gói Hosting đã tích hợp sẵn SVN bạn nhé. Mình có các gói Hosting bình thường (có tích hợp - có thể test luôn) và gói chuyên dùng SVN (Không có MySQL - dung lượng ổ đĩa lớn hơn gói hosting bình thường.

    Các Bạn có nhu cầu sử dụng dịch vụ SVN thì liên hệ mình nhé

    Link bảng giá hosting SVN: http://hostingviet.vn/di...osting-tai-viet-nam.html

    Hướng dấn sử dụng SVN: http://hostingviet.vn/download-tai-l...vn/detail.html

    Liên hệ:
    Nguyễn Trung Văn
    Email: banhang@hostingviet.vn / van.nguyentrung88@gmail.com
    YM: vannt_99 - Skype: vannt_99
    ĐT: 01656.95.86.88
    Website: http://hostingviet.vn
    Are you sure you want to
    Your message goes here
    Processing…
  • its good
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Subversion User Guide Subversion User Guide Presentation Transcript

    • Subversion
      • Official Subversion site:
        • http://subversion.tigris.org/
        • http://svnbook.red-bean.com/
      • Wikipedia topic:
        • http://en.wikipedia.org/wiki/Subversion_%28software%29
      www.intellibitz.com [email_address]
    • Repository and Modules
      • Repository are created and maintained by SVN Administrator
      • Modules are imported and updated by Users
      • Many Repositories can exist in a SVN Server
      • Many Modules can exist in a single Repository
      • As an end user we care about modules
      www.intellibitz.com [email_address]
    • Subversion Workflow
      • Create a repository (once)
      • Import or Checkout repository (once)
      • Update and Checkin
      • Merge
      • Commit
      www.intellibitz.com [email_address]
    • User Workflow
      • Step 1
        • Obtain SVN Repository URL from SVN Admin
        • Ex 1: svn://svn.intellibitz.net/repos/web
        • Ex 2: http://sted.svn.sourceforge.net/viewvc/sted/
      • Step 2
        • Checkout SVN module (Repository Copy) to local file system (Working Copy)
      • Step 3
        • Update, Commit, Branch, Tag etc.,
      www.intellibitz.com [email_address]
    • Subversion Architecture www.intellibitz.com [email_address]
    • Repository Access
      • As of version 1.4, Subversion repositories can be accessed by the following means:
        • Local filesystem or network filesystem, accessed by client directly.
        • WebDAV/DeltaV (over http or https) using the mod_dav_svn module for Apache 2.
        • Custom "svn" protocol (default port 3690), using plaintext or over SSH.
      www.intellibitz.com [email_address]
    • Subversion Components
      • svn (this is what you need)
        • The command-line client program .
      • svnadmin
        • A tool for creating, tweaking or repairing a Subversion repository.
      • svnserve
        • A custom standalone server program, runnable as a daemon process or invokable by SSH; another way to make your repository available to others over a network.
      www.intellibitz.com [email_address]
    • Repository – Client Usage www.intellibitz.com [email_address]
    • Repository URL's
      • Subversion repositories can be accessed through many different methods—on local disk, or through various network protocols, depending on how your administrator has set things up for you. A repository location, however, is always a URL .
        • Schema Access Method
          • file:/// direct repository access (on local disk)
          • http:// access via WebDAV protocol to Subversion-aware Apache server
          • https:// same as http://, but with SSL encryption.
          • svn:// access via custom protocol to an svnserve server
          • svn+ssh:// same as svn://, but through an SSH tunnel.
      www.intellibitz.com [email_address]
    • Repository – common layout
      • Subversion allows you to layout your repository any way that you choose, we recommend you create a trunk directory to hold the “main line” of development, a branches directory to contain branch copies, and a tags directory to contain tag copies,
        • for example:
          • svn list file:///usr/local/svn/repos
            • /trunk
            • /branches
            • /tags
      www.intellibitz.com [email_address]
    • Understanding Revisions
      • 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.c and foo.c are at revision 25
        • Modify bar.c and commit
        • Then update the working copy
      • Now bar.c and foo.c are at revision 26, except that foo.c in revision 25 and 26 are identical
      • No additional space in repository required, i.e. a cheap copy or a symbolic link is made
      www.intellibitz.com [email_address]
    • Understanding Revisions www.intellibitz.com [email_address]
    • Import
      • Import - I have the files and I want to put them into the initial repository
        • (Working Copy to Repository)
        • $ svnadmin create /usr/local/svn/newrepos
        • $ svn import mytree file:///usr/local/svn/newrepos/some/project
        • -m "Initial import"
        • Adding mytree/foo.c
        • Adding mytree/bar.c
        • Adding mytree/subdir
        • Adding mytree/subdir/quux.h
        • Committed revision 1.
      www.intellibitz.com [email_address]
    • Checkout
      • Checkout - I want to start working on an existing repository
        • (Repository to Working copy)
          • $ svn checkout http://svn.collab.net/repos/svn/trunk
          • A trunk/Makefile.in
          • A trunk/build.conf
          • Checked out revision 8810.
      www.intellibitz.com [email_address]
    • Basic Work Cycle
      • Update your working copy
      • Make changes
      • Examine your changes
      • Possibly undo some changes
      • Resolve Conflicts (Merge Others' Changes)
      • Commit your changes
      www.intellibitz.com [email_address]
    • Basic Work Cycle
      • Update your working copy
        • svn update
      • Make changes
        • svn add
        • svn delete
        • svn copy
        • svn move
      • Examine your changes
        • svn status
        • svn diff
      www.intellibitz.com [email_address]
    • Basic Work Cycle
      • Possibly undo some changes
        • svn revert
      • Resolve Conflicts (Merge Others' Changes)
        • svn update
        • svn resolved
      • Commit your changes
        • svn commit
      www.intellibitz.com [email_address]
    • Update
      • Update - Updates the local files to match the central repository
        • NOTE: Change to the working folder (the local folder that you have checked out from the repository into your local file system)
            • svn update
            • U foo.c
            • U bar.c
            • Updated to revision 2.
      www.intellibitz.com [email_address]
    • Update – Working Copy
      • svn add foo
        • Schedule file, directory, or symbolic link foo to be added to the repository. When you next commit, foo will become a child of its parent directory. Note that if foo is a directory, everything underneath foo will be scheduled for addition. If you only want to add foo itself, pass the --non-recursive (-N) option.
      www.intellibitz.com [email_address]
    • Update – Working Copy
      • svn delete foo
        • Schedule file, directory, or symbolic link foo to be deleted from the repository. If foo is a file or link, it is immediately deleted from your working copy. If foo is a directory, it is not deleted, but Subversion schedules it for deletion. When you commit your changes, foo will be removed from your working copy and the repository. [4]
      www.intellibitz.com [email_address]
    • Update – Working Copy
      • svn copy foo bar
        • Create a new item bar as a duplicate of foo and automatically schedule bar for addition. When bar is added to the repository on the next commit, its copy history is recorded (as having originally come from foo). svn copy does not create intermediate directories.
      www.intellibitz.com [email_address]
    • Update – Working Copy
      • svn move foo bar
        • This command is exactly the same as running svn copy foo bar; svn delete foo. That is, bar is scheduled for addition as a copy of foo, and foo is scheduled for removal. svn move does not create intermediate directories.
      www.intellibitz.com [email_address]
    • Update – Working Copy
      • svn mkdir blort
        • This command is exactly the same as running mkdir blort; svn add blort. That is, a new directory named blort is created and scheduled for addition.
      www.intellibitz.com [email_address]
    • Update
      • 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 and what it means
        • 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.
        • G `foo'
          • File `foo' received new changes, but also had changes of your own to begin with. The changes did not intersect, however, so Subversion has mer(G)ed the repository's changes into the file without a problem.
        • C `foo'
          • File `foo' received (C)onflicting changes from the server. The changes from the server directly overlap your own changes to the file. No need to panic, though. This overlap needs to be resolved by a human (you).
      www.intellibitz.com [email_address]
    • Examine Local Changes
      • svn status
        • A stuff/loot/bloo.h # file is scheduled for addition
        • C stuff/loot/lump.c # file has textual conflicts from an update
        • D stuff/fish.c # file is scheduled for deletion
        • M bar.c # the content in bar.c has local modifications
        • A item
        • The file, directory, or symbolic link item has been scheduled for addition into the repository.
        • C item
        • The file item is in a state of conflict. That is, changes received from the server during an update overlap with local changes that you have in your working copy. You must resolve this conflict before committing your changes to the repository.
        • D item
        • The file, directory, or symbolic link item has been scheduled for deletion from the repository.
        • M item
        • The contents of the file item have been modified.
      www.intellibitz.com [email_address]
    • Examine Local Changes
      • svn status -u -v
        • M * 44 23 sally README
        • M 44 20 harry bar.c
        • * 44 35 harry stuff/trout.c
        • D 44 19 ira stuff/fish.c
        • A 0 ? ? stuff/things/bloo.h
        • Status against revision: 46
        • Notice the two asterisks: if you were to run svn update at this point, you would receive changes to README and trout.c. This tells you some very useful information—you'll need to update and get the server changes on README before you commit, or the repository will reject your commit for being out-of-date. (More on this subject later.)
      www.intellibitz.com [email_address]
    • Examine Changes in detail
      • svn diff
        • Index: bar.c
        • ===================================================================
        • --- bar.c (revision 3)
        • +++ bar.c (working copy)
        • @@ -1,7 +1,12 @@
        • +#include <sys/types.h>
        • +#include <sys/stat.h>
        • +#include <unistd.h>
        • +
        • +#include <stdio.h>
        • int main(void) {
        • - printf(&quot;Sixty-four slices of American Cheese... &quot;);
        • + printf(&quot;Sixty-five slices of American Cheese... &quot;);
        • return 0;
        • }
      www.intellibitz.com [email_address]
    • Undoing local changes
      • svn revert ITEM has exactly the same effect as deleting ITEM from your working copy and then running svn update -r BASE ITEM. However, if you're reverting a file, svn revert has one very noticeable difference—it doesn't have to communicate with the repository to restore your file.
        • $ svn revert README
        • Reverted 'README'
      www.intellibitz.com [email_address]
    • Resolove Conflicts
      • Suppose you run svn update and some interesting things occur:
        • $ svn update
        • U INSTALL
        • G README
        • C bar.c
        • Updated to revision 46.
      • The U and G codes are no cause for concern; those files cleanly absorbed changes from the repository. The files marked with U contained no local changes but were Updated with changes from the repository. The G stands for merGed, which means that the file had local changes to begin with, but the changes coming from the repository didn't overlap with the local changes.
      • But the C stands for conflict. This means that the changes from the server overlapped with your own, and now you have to manually choose between them.
      www.intellibitz.com [email_address]
    • Resolove Conflicts
      • Whenever a conflict occurs, three things typically occur to assist you in noticing and resolving that conflict:
        • Subversion prints a C during the update, and remembers that the file is in a state of conflict.
        • If Subversion considers the file to be mergeable, it places conflict markers—special strings of text which delimit the “sides” of the conflict—into the file to visibly demonstrate the overlapping areas.
        • For every conflicted file, Subversion places three extra unversioned files in your working copy:
          • filename.mine
            • This is your file as it existed in your working copy before you updated your working copy—that is, without conflict markers. This file has only your latest changes in it. (If Subversion considers the file to be unmergeable, then the .mine file isn't created, since it would be identical to the working file.)
          • filename.rOLDREV
            • This is the file that was the BASE revision before you updated your working copy. That is, the file that you checked out before you made your latest edits.
          • filename.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. (Here OLDREV is the revision number of the file in your .svn directory and NEWREV is the revision number of the repository HEAD.)
      www.intellibitz.com [email_address]
    • Resolove Conflicts
      • For example, Sally makes changes to the file sandwich.txt in the repository. Harry has just changed the file in his working copy and checked it in. Sally updates her working copy before checking in and she gets a conflict:
        • $ svn update
        • C sandwich.txt
        • Updated to revision 2.
        • $ ls -1
        • sandwich.txt
        • sandwich.txt.mine
        • sandwich.txt.r1
        • sandwich.txt.r2
      • At this point, Subversion will not allow you to commit the file sandwich.txt until the three temporary files are removed.
      www.intellibitz.com [email_address]
    • Resolove Conflicts
          • $ svn commit -m &quot;Add a few more things&quot;
          • svn: Commit failed (details follow):
          • svn: Aborting commit: '/home/sally/svn-work/sandwich.txt' remains in conflict
      • If you get a conflict, you need to do one of three things:
        • Merge the conflicted text “by hand” (by examining and editing the conflict markers within the file).
        • Copy one of the temporary files on top of your working file.
        • Run svn revert <filename> to throw away all of your local changes.
      • Once you've resolved the conflict, you need to let Subversion know by running svn resolved. This removes the three temporary files and Subversion no longer considers the file to be in a state of conflict.[6]
          • $ svn resolved sandwich.txt
          • Resolved conflicted state of 'sandwich.txt'
      www.intellibitz.com [email_address]
    • Merge
      • We both update the same file at the same time. What happens?
      • Update tells me there is a conflict
        • You checked yours in first
      • I have to merge the two updates together.
        • Before checking in
      www.intellibitz.com [email_address]
    • Merge Conflicts by hand
      • Merging conflicts by hand can be quite intimidating the first time you attempt it, but with a little practice, it can become as easy as falling off a bike.
      www.intellibitz.com [email_address]
      • Here's an example. Due to a miscommunication, you and Sally, your collaborator, both edit the file sandwich.txt at the same time. Sally commits her changes, and when you go to update your working copy, you get a conflict and you're going to have to edit sandwich.txt to resolve the conflicts. First, let's take a look at the file:
        • $ cat sandwich.txt
        • Top piece of bread
        • Mayonnaise
        • Lettuce
        • Tomato
        • Provolone
        • <<<<<<< .mine
        • Salami
        • Mortadella
        • Prosciutto
        • =======
        • Sauerkraut
        • Grilled Chicken
        • >>>>>>> .r2
        • Creole Mustard
        • Bottom piece of bread
    • Merge Conflicts by hand
      • The strings of less-than signs, equal signs, and greater-than signs are conflict markers, and are not part of the actual data in conflict. You generally want to ensure that those are removed from the file before your next commit. The text between the first two sets of markers is composed of the changes you made in the conflicting area:
        • <<<<<<< .mine
        • Salami
        • Mortadella
        • Prosciutto
        • =======
        • The text between the second and third sets of conflict markers is the text from Sally's commit:
        • =======
        • Sauerkraut
        • Grilled Chicken
        • >>>>>>> .r2
      www.intellibitz.com [email_address]
      • Usually you won't want to just delete the conflict markers and Sally's changes—she's going to be awfully surprised when the sandwich arrives and it's not what she wanted. So this is where you pick up the phone or walk across the office and explain to Sally that you can't get sauerkraut from an Italian deli.[7] Once you've agreed on the changes you will check in, edit your file and remove the conflict markers.
        • Top piece of bread
        • Mayonnaise
        • Lettuce
        • Tomato
        • Provolone
        • Salami
        • Mortadella
        • Prosciutto
        • Creole Mustard
        • Bottom piece of bread
    • Merge Conflicts by hand
      • Now run svn resolved, and you're ready to commit your changes:
          • $ svn resolved sandwich.txt
          • $ svn commit -m &quot;Go ahead and use my sandwich, discarding Sally's edits.&quot;
      • Note that svn resolved requires an argument. In any case, you want to be careful and only run svn resolved when you're certain that you've fixed the conflict in your file—once the temporary files are removed, Subversion will let you commit the file even if it still contains conflict markers.
      • If you ever get confused while editing the conflicted file, you can always consult the three files that Subversion creates for you in your working copy—including your file as it was before you updated. You can even use a third-party interactive merging tool to examine those three files.
      www.intellibitz.com [email_address]
    • Merge – Copying File
      • Copying a File Onto Your Working File
        • If you get a conflict and decide that you want to throw out your changes, you can merely copy one of the temporary files created by Subversion over the file in your working copy:
          • svn update
              • C sandwich.txt
              • Updated to revision 2.
          • ls sandwich.*
              • sandwich.txt sandwich.txt.mine sandwich.txt.r2 sandwich.txt.r1
          • cp sandwich.txt.r2 sandwich.txt
          • svn resolved sandwich.txt
      www.intellibitz.com [email_address]
    • Merge – Reverting File
      • Punting: Using svn revert
        • If you get a conflict, and upon examination decide that you want to throw out your changes and start your edits again, just revert your changes:
          • $ svn revert sandwich.txt
              • Reverted 'sandwich.txt'
          • $ ls sandwich.*
              • sandwich.txt
        • Note that when you revert a conflicted file, you don't have to run svn resolved.
      www.intellibitz.com [email_address]
    • Checkin
      • Check-in - Update the central repository to match your local files
      • Always update before checking in (svn enforces this)
      • Always test with the latest update before checking in (not enforced)
      www.intellibitz.com [email_address]
    • Commit
      • svn commit command sends all of your changes to the repository. When you commit a change, you need to supply a log message, describing your change. Your log message will be attached to the new revision you create. Log message can be set in command line using the --message (or -m) switch:
        • $ svn commit -m &quot;Corrected number of cheese slices.&quot;
          • Sending sandwich.txt
          • Transmitting file data .
          • Committed revision 3.
      www.intellibitz.com [email_address]
    • Examining History
      • Subversion repository keeps a record of every change ever committed, and allows you to explore this history by examining previous versions of files and directories as well as the metadata that accompanies them. With a single Subversion command, you can check out the repository (or restore an existing working copy) exactly as it was at any date or revision number in the past.
      www.intellibitz.com [email_address]
    • Examining History
      • However, sometimes you just want to peer into the past instead of going into the past.
      • svn log
        • Shows you broad information: log messages with date and author information attached to revisions, and which paths changed in each revision.
      www.intellibitz.com [email_address]
      • svn diff
        • Shows line-level details of a particular change.
      • svn cat
        • This is used to retrieve any file as it existed in a particular revision number and display it on your screen.
      • svn list
        • Displays the files in a directory for any given revision.
    • Branching www.intellibitz.com [email_address]
    • Branching www.intellibitz.com [email_address]
    • Creating a Branch
      • Create a branch by making a copy of the project in the repository using the svn copy command. Subversion is not only able to copy single files, but whole directories as well.
        • svn copy http://svn.example.com/repos/calc/trunk
        • http://svn.example.com/repos/calc/branches/my-calc-branch
        • -m &quot;Creating a private branch of /calc/trunk.&quot;
        • Committed revision 341.
      www.intellibitz.com [email_address]
    • Creating a Tag
      • A tag is just a “snapshot” of a project in time. In Subversion, this idea already seems to be everywhere. Each repository revision is exactly that—a snapshot of the filesystem after each commit.
        • svn copy http://svn.example.com/repos/calc/trunk
        • http://svn.example.com/repos/calc/tags/release-1.0
        • -m &quot;Tagging the 1.0 release of the 'calc' project.&quot;
        • Committed revision 351.
      www.intellibitz.com [email_address]
    • Summary
      • Import / Checkout
        • The first time to add / retrieve module
      • Update
        • Everytime to refresh working copy
      • Merge
        • Working copy conflicts with repository copy, the repository copy is updated by another user
      • Commit
        • Send local changes to the repository
      www.intellibitz.com [email_address]
    • Resources
      • http://subversion.tigris.org/
      • http://svnbook.red-bean.com/
      • www.orcaware.com/svn/Subversion-Blair_Zajac.ppt
      • http://groups.google.com/group/etoe
      www.intellibitz.com [email_address]
    • IntelliBitz Technologies
      • http://training.intellibitz.com
      • http://groups.google.com/group/etoe
      • http://sted.sourceforge.net
        • 168, Medavakkam Main Road, Madipakkam
        • Chennai, 600091, India.
        • +91 44 2247 5106
        • [email_address]
      www.intellibitz.com [email_address]
    • IntelliBitz Technologies www.intellibitz.com [email_address]
        • Thank You!