• Save
Totalsvn Usage And Administration By Gopi
Upcoming SlideShare
Loading in...5
×
 

Totalsvn Usage And Administration By Gopi

on

  • 1,485 views

Complete SVN Usage and Administration

Complete SVN Usage and Administration

Statistics

Views

Total Views
1,485
Views on SlideShare
1,478
Embed Views
7

Actions

Likes
0
Downloads
0
Comments
0

2 Embeds 7

http://www.linkedin.com 6
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Totalsvn Usage And Administration By Gopi Totalsvn Usage And Administration By Gopi Presentation Transcript

  • Subversion (SVN) Tutorial Version control with Subversion & its Administration how to set it up, use it, and save your sanity how to set it up, use it, and save your sanity By Gopinath Karangula E-mail : gopinathkarangula@gmail.com
  • What is version control?
    • Version management allows you to control and monitor changes to files
      • What changes were made?
      • Revert to pervious versions
      • When were changes made
      • What code was present in release 2.7?
    • Earliest tools were around 1972 (SCCS)
    • Older tools – RCS, CVS, Microsoft Source Safe, PVCS Version Manager, etc…
    • Current tools – Subversion, Mercurial, Git, Bazaar
  • We will use subversion (svn)
    • Why?
    • Because it’s popular
    • It’s well supported
      • IDEs - Netbeans, Eclipse
      • Numerous GUI tools
      • Command line
  • subversion concepts
    • checkout – get a local copy of the files
      • I have no files yet, how do I get them?
    • add – add a new file into the repository
      • I created a new file and want to check it in
    • commit – send locally modified files to the repository
      • I’ve made changes, how do I send them to the group?
    • update – update all files with latest changes
      • Other people made changes, how do I get them?
    • tag / branch – label a “release”
      • I want to “turn in” a set of files
  • Advantages of Version Control
    • Source Code Management
    • Distributed Work Environment
    • Knowledge Sharing
    • Version control / Revision control
    • Easy to track the modification
  • Version Control Steps
    • Create a repository of project files (code)
    • CHECKOUT a working copy of the code to working directory
    • Edit code
    • COMMIT your changes back into the repository
    • If someone else changed the same file as you, resolve differences to the changed files as needed (MERGE)
    • UPDATE your working copy before continuing work the next time
  • Version control models
  • File sharing: the problem to avoid
  • Lock-Modify-Unlock Lock-Modify-Unlock
  • Copy-Modify-Merge
  • Copy-Modify-Merge (cont’d)
  • Working with Tortoise SVN
    • First you should download Tortoise SVN Client, avaiable in .msi format.
    • It should be installed, after successful installation, your system will be getting restarted.
    • In windows expolorer, just right clik on any folder and check wether the following additional menu items will be available..
  • Tortoise SVN Client Daily Tasks
    • checkout
    • Edit a file
    • commit
    • Add ( Files /Folder)
    • Update
    • Merge
    • Differentiate
    • Lock
    • Release Lock
  • Create a repository using Tortoise SVN
    • After installing tortoise SVN you should add the the URL provided by your system admin:
    • Eg: https://192.168.11.159:8443/svn
    • Goto Start -> Select Tortoise SVN -> Repository Browser ->
  •  
    • After adding the URL in the URL Repository, you should select the path for the check out directory.
    • The cehck out directory will be your local working copy.
    • So you will be doing modifications in local working copy using IDEs like ellipse.
    • After succesful check out, your local working copy folder will be indicated with green symbol.
  • Adding a new file to the Repository
      • Move, copy, or create a new file that will be added to the repository
        • Give the file a descriptive name to distinguish it from other files
        • (Remember, we are adding a new file.)
  • TortoiseSVN: Add a new file to the repository (continued)
      • Use “Add” to add it to the local repository
        • Right-click the new file
        • (Here, right-click on “Aesthetic”)
        • Click “TortoiseSVN->Add”
        • A window appears
        • Click “OK”
        • A blue “plus” symbol should appear on the file in Windows Explorer:
  • Tortoise SVN: Add a new file to the repository (continued)
      • Right-click on the file you just added
      • Choose “SVN Commit…” to commit it to the repository:
      • This window appears:
      • Once it says “Completed”
      • you have added a file to the repository!
      • Congratulations!
  • TortoiseSVN: Modify an existing file in the repository
    • Overview:
      • “ Check out” the folder containing the file to be modified
      • Edit and save the file on your computer
      • “ Commit” the changes you have made
  • TortoiseSVN: Modifying a file (continued)
    • Checkout appropriate folder from the repository
      • Start the “Repo-browser”
      • (Repository browser)
  • TortoiseSVN: Modifying a file (continued)
    • Choose the folder containing the file you want to edit
    • (Here, have chosen Aesthetic/)
    • Right-click on the folder and choose “Checkout…”
    • A “Checkout” window appears
  • TortoiseSVN: Modifying a file (continued)
    • Click the “…” next to “Checkout Directory”
    • A “Browse for Folder” window appears
    • Browse to the folder on your computer where you want to create a local copy of the repository folder
    • Create a folder with the same name as the one in the repository
        • Click “Make New Folder”
        • Enter the new folder name
        • (Here “Aesthetic”)
    • Click “OK”
  • TortoiseSVN: Modifying a file (continued)
      • Double-click the file you want to open
      • Edit the file (In Simile, for example)
      • Save it
      • The file now appears like this:
      • (This means it has been modified but changes have not been “committed” to the repository.)
      • This window appears:
      • Once it says “Completed”
      • you have modified the repository!
      • Congratulations!
  • SVN Update
    • Update gets all new changes from the repository.
      • svn update
      • GUI Users: you should get it by now
    • What happens if there is a conflict?
      • User A has version 3 of the file, modifies it, commits it creating version 4.
      • User B has version 3 of the file, modifies it, commits it
        • CONFLICT – User B’s copy of the file was out of date. User B must merge their changes into Version 4
      • For text files (like source code) SVN can help do this in an automated way
      • For binary files SVN cannot help… must be done manually
    • Lesson: Always ensure you have the latest version (update frequently). If multiple people are editing the same file you could have problems
  • Summary – Checking things in
    • Create the repository by “svn checkout”
    • Copy your documents into “trunk” directory
    • Use “svn add” to mark files to include in the repository
      • Use “svn commit” to send the files to the repository
    • Modify files, “svn commit” as needed until your deliverable is complete
    • svn commit (don’t forget the final commit!)
  • SVN Administration : Trunk : Updated and major code of the project Tag : Showcase of Release versions and ready to pack Branches : Contain Total source code, which was divided and distributed to the workforce, where a source code commits happens on the branches for development and merged to test branch to bug fix, and add patches to stabilize the code ( Quality analysis), merged to release branch and deployed to production safely.
  • Project Repository Creation using Visual Svn server : Using Visual SVN Server : we can perform: 1. Fresh creation of Repository with default structure of the Project 2. Creation of the Project Folder with out default Project structure. 3.User management and manging the privileges on branches, trees and tags. 4. Hook scripts management – post-commit scripts for E-mail notification to the testing team Precommit hook – To block the developers with empty log message commits, using command line also we can manage the repository by installing the subversion package, but for easy administration we use this visual svn server.
  • SVN Repository Backup: Backs up are available of three types in svn : 1. svndump : Dumping ( taking backup of the entire repository). 2. Hotbackup : It is a kind of backup where the entire project repository can be imported in very less time compared to the restroing the repository from svn dump. 3. Incremental Backup : Taking a range of versions backup
  • Commands to take the Project Repository Backup: Commands : 1. Svn dump : Entire repository : 1. c:/ProgramFiles/Visualsvn/bin/svnadmin dump C:/Repository/Repo_name > [Target Folder].dump 2. Svn Hot-copy : c:/ProgramFiles/Visualsvn/bin/svnadmin hot copy C:/Repository/Repo_name [Target Folder].dump
  • SVN Repository Backup: 3. Incremental Backup : c:/ProgramFiles/Visualsvn/bin/svnadmin dump -r:15:30 C:/Repository/Repo_name > [Target Folder].dump Here 15 indicated the starting version and 30 indicates the end version.
  • SVN Repository Backup: Backs up are available of two types in svn : 1. svndump : Dumping ( taking backup of the entire repository). 2. Hot backup : It is a kind of backup where the entire project repository can be imported in very less time compared to the restoring the repository from svn dump.
  • SVN Repository Restore: Commands : 1. Svn load : Entire repository : 1. c:/ProgramFiles/Visualsvn/bin/svnadmin load C:/Repositories/repositoryname < repobackup.dump This command leads to restore of the entire repository. 2. The second way of restoring the hot copy backup dump file : Open the visual svn server and create a repository folder and select the import tab and browse to the location where the dump file located and press ok, the hot copy backup repository wil be restored.
  • Hook Scripts to manage the Project repositories : What is Hook: Hook is a group of policies for a effective management of the project repository. There are serveral Hooks scripts available in the subversion ( SVN) 1. Pre-Commit Hook ( Check the policy before the commit happen to the repository) Eg: Empty log messages can be blocked using this pre commit hook 2. Post Commit Hook ( Check the policy after the happen to the repository) Eg: Email notifications to each commit to testing team for quality analysis.
  • Hook Scripts : Pre Commit Hook to block the Empty Log Messages : &quot;C:Program FilesVisualSVN Serverbinsvnlook.exe&quot; log -t %2 %1 | FindStr [a-zA-Z0-9] IF %ERRORLEVEL% EQU 0 GOTO OK echo &quot;Commit Comments are Required, Dear developer please give the task details in detail for this commit&quot; >&2 exit 1 :OK exit 0
  • Post Commit Hook for Email Notifications to testing team : &quot;C:Program FilesVisualSVN ServerbinVisualSVNServerHooks.exe&quot; ^ commit-notification &quot;%1&quot; -r %2 ^ --from gopinath.karangula@ghoom.com --to xxxx@mic.co.in,xxxxxi@domain.in,xxxxx@domain.com ^ --smtp-server smtpout.secureserver.net ^ --smtp-user XXXXXXX@domain.com ^ --smtp-password XXXXXXXX
  •