Hướng dẫn sử dụng SVN
Nội dung chia sẻ: SVN Tutorial
SVN Tutorial i SVN TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com TUTORIALS POINT Simply Easy Learning ABOUT THE TUTORIAL SVN Tutorial Apache Subversion which is often abbreviated as SVN, is a software versioning and revision control system distributed under an open source license. Subversion was created by CollabNet Inc. in 2000, but now it is developed as a project of the Apache Software Foundation, and as such is part of a rich community of developers and users. This tutorial will give you great understanding on SVN system needed to maintain current and historical versions of files such as source code, web pages, and documentation. Audience This tutorial is designed for Software Professionals who are willing to learn SVN system in simple and easy steps. This tutorial will give you great understanding on SVN system concepts and after completing this tutorial you will be at intermediate level of expertise from where you can take yourself at higher level of expertise. Prerequisites Before proceeding with this tutorial you should have a basic understanding on simple terminologies like programming language, source code, documents etc. Because you are going to use SVN to handle all levels of software projects in your organization, so it will be good if you have knowledge of software development and software testing processes. Copyright & Disclaimer Notice ¤All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content from tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the accuracy of the site or its contents including this tutorial. If you discover that the tutorialspoint.com site or this tutorial content contains some errors, please contact us at email@example.com TUTORIALS POINT Simply Easy Learning Table of Content SVN Tutorial . 2 Audience. 2 Prerequisites 2 Copyright & Disclaimer Notice . 2 Basic Concepts 4 Version Control Terminologies . 4 Environment Setup . 6 Apache Setup . 7 User Setup . 7 Repository Setup 8 Life Cycle 10 Create repository: . 10 Checkout: . 10 Update:. 10 Perform changes: . 10 Review changes: 11 Fix mistakes: 11 Resolve conflicts: . 11 Commit changes: . 11 Checkout Process 12 Perform Changes . 13 Review Changes 15 Update Process 17 Fix Mistakes . 21 Resolve Conflicts 24 Step 2: Postpone Conflicts . 25 Step 3: Resolve Conflicts . 26 Tags 28 Branching . 29 TUTORIALS POINT Simply Easy Learning Basic Concepts What is Version Control System? Version Control System is a software that helps software developers to work together and also maintains complete history of their work. Following are goals of Version Control System. x Allow developers to work simultaneously. x Do not overwrite each other’s changes. x Maintain history of every version of everything. Version control system is divided into two categories. x Centralized version control system (CVCS) and x Distributed/Decentralized version control system (DVCS) In this tutorial session we will concentrate only on Centralized Version Control System and especiallySubversion. Subversion falls under centralized version control system, meaning that it uses central server to store all files and enables team collaboration. Version Control Terminologies Let us start by discussing some of the terms that we will be using in our tutorial. x The Repository: A repository is the heart of any version control system. It is central place where developers store all their work. Repository not only stores files but also history. Repository is accessed over a network, with repository acting as a sever and version control tool acting as a client. Client can connect to repository, and then they can store/retrieve their changes to/from repository. By storing changes, a client makes available these changes to other people and by retrieving changes; a client takes other people changes as a working copy. x Trunk: The trunk is a directory where all the main development happens and is usually checked out by developers to work on the project. CHAPTER 1 TUTORIALS POINT Simply Easy Learning x Tags: The tags directory is used to store named snapshots of the project. Tag operation allows to give descriptive and memorable names to specific version in the repository. For example LAST_STABLE_CODE_BEFORE_EMAIL_SUPPORT is more memorable than Repository UUID: 7ceef8cb-3799-40dd-a067-c216ec2e5247 and Revision: 13 x Branches: Brach operation is used to create another line of development. It is useful when you want your development process to fork off into two different directions. For example, when you release version 5.0, you might want to create a branch so that development of 6.0 features can be kept separate from 5.0 bug-fixes. x Working copy: Working copy is a snapshot of the repository. The repository is shared by all the team, but people do not modify it directly. Instead each developer checkout working copy. The working copy is private workplace where developer can do their work within isolated from the rest of the team. x Commit changes: Commit is a process of storing changes from private workplace to central server. After commit, changes are made available to all the team. Other developer can retrieve these changes by updating their working copy. Commit is atomic operation. Either whole commit succeeds or is rolled back. Users never see half finished commit. TUTORIALS POINT Simply Easy Learning Environment Setup SVN Installation Subversion is popular open-source Version Control tool. As it’s open-source it is available for free over a internet. It comes by default with most of the GNU/Linux distributions, so it might be already installed on your system. To check whether it is installed or not use following command. [jerry@CentOS ~]$ svn --version If Subversion client is not installed, then command will report error, otherwise it will display version of the installed software. [jerry@CentOS ~]$ svn --version -bash: svn: command not found If you are using RPM based GNU/Linux then use yum command for installation. After successful installation execute svn --version command. [jerry@CentOS ~]$ su - Password: [root@CentOS ~]# yum install subversion [jerry@CentOS ~]$ svn --version svn, version 1.6.11 (r934486) compiled Jun 23 2012, 00:44:03 And if you are using Debian based GNU/Linux then use apt command for installation. [jerry@Ubuntu]$ sudo apt-get update [sudo] password for jerry: [jerry@Ubuntu]$ sudo apt-get install subversion [jerry@Ubuntu]$ svn --version svn, version 1.7.5 (r1336830) compiled Jun 21 2013, 22:11:49 CHAPTER 2 TUTORIALS POINT Simply Easy Learning Apache Setup We have seen how to install Subversion client on GNU/Linux. Let us see how to create new repository and allow access to users. On server we have to install Apache httpd module and svnadmin tool. [jerry@CentOS ~]$ su - Password: [root@CentOS ~]# yum install mod_dav_svn subversion The mod_dav_svn package allows access to a repository using HTTP, via the Apache httpd server andsubversion package installs svnadmin tool. Subversion reads it's configuration from /etc/httpd/conf.d/subversion.conf file. After adding configuration subversion.conf file will look like this. LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module .