31
Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Embed Size (px)

Citation preview

Page 1: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Chapter2: Version Control

Student List:

Nguyễ�n Lễ Quố�c SơnHuỳnh Hữu Tài

Lễ Anh TânTrâ�n Thanh ThiệnTrâ�n Hoàng Thịnh

Page 2: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Reference

TortoiseSVN A Subversion client for Windows Version 1.7by Stefan Küng, Lübbe Onken, and Simon Large

Version Control with Subversion: For Subversion 1.4by Ben Collins-Sussman, Brian W. Fitzpatrick,

C.Michael Pilato

http://www.google.com.vn/, http://www.wikipedia.org/

02._Version_Control.pdfby Lecturer Ngố Huy Biễn

Page 3: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Table of Contents

I ntroduction to Version Control

Why is Version Control

important?

The Basic Concepts

Version Control Tools

Install and Demo

Page 4: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

What is Version Control?

Version control is the management of changes to documents, programs, large web sites and other information stored as computer files.

It is most commonly used in software development, where a team of people may change the same files.

Changes are usually identified by a number or letter code, termed the "revision number“ or simply "revision". Each revision is associated with a timestamp and the person making the change. Revisions can be compared, restored, and with some types of files, merged.

Page 5: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Why is Version Control important?

Any stored revision of a file can be retrieved to be viewed or changed.

The differences between any two revisions can be displayed.

Patches can be created automatically. Multiple developers can work simultaneously on

the same project or file without loss of data. The project can be branched to allow

simultaneous development along varied tracks. These branches can be merged back into the main line of development.

Distributed development is supported across large or small networks.

Page 6: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

The Basic Concepts Branch Checkout/Update Comment Commit Conflict Deltas Head Import Label

Lock Merge Repository Resolve Revision Tag Trunk Working f older Workspace …

Page 7: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

The Basic Concepts Branch

A set of files under version control may be branched or forked at a point in time so that, from that time forward, two copies of those files may be developed at different speeds or in different ways independently of the other.

Page 8: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

The Basic Concepts Checkout/Update

Creates a local working copy/dowload from the repository.

CommentComments are the key to understanding your

project’s history.

CommitTo save your working copy of the file into the

repository. Referred to as Check-in in some version control systems.

Page 9: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

The Basic Concepts Conflict

The situation when two people try to commit changes that affect the same region of the same file. These must be resolved, either using a Merge tool, or manually. Deltas

Is the difference between the two revisions.

HeadThe most recent commit.

Page 10: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

The Basic Concepts Import

An import is the action of copying a local directory tree (that is not currently a working copy) into the repository for the first time. Label See tag. Label

A "label" is a human-meaningful name that can be used to select a specific version from a version history. A label can be assigned to a specific version of a resource. The same label can be used in different version histories. Lock

A lock prevents anybody from editing a file but you.

Page 11: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

The Basic Concepts Merge

A merge is the process of combining multiple changes and resolving any conflicts. If two programmers change a file separately and both check it in, the second programmer will need to merge in the first person's changes. Repository

The repository is the master storage for all of your files and and their history. It's typically stored on the version control server. Each stand-alone project should have its own repository. Resolve

The act of user intervention to address a conflict between different changes to the same document.

Page 12: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

The Basic Concepts Revision

Also version: A version is any change in form. In SVK, a Revision is the state at a point in time of the entire tree in the repository. Tag

A tag or label refers to an important snapshot in time, consistent across many files. These files at that point may all be tagged with a user-friendly, meaningful name or revision number. See the discussion of baselines, labels, and tags. Trunk

The unique line of development that is not a branch (sometimes also called Baseline or Mainline).

Page 13: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

The Basic Concepts Working copy

Your copy of the file that you actually make your changes in.

Working folderFolder where you check files out to work on

them, also referred to.

WorkspaceAn area where can work separated from the

reposity and to isolate each user from the others.

Page 14: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Version Control Tools

Page 15: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Version Control Tools

Page 16: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Version Control Tools

Page 17: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Version Control Tools

Page 18: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Install and Demo Install VisualSVN Server2.5.2, TortoiseSVN 1.7.4 Create Repository by VisualSVN Server Create users in VisualSVN Server Add, commit, update, delete information in TortoiseSVN Check log in TortoiseSVN Check for modificcations in TortoiseSVN Confliict in TortoiseSVN Branching – Merging in TortoiseSVN

Page 19: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Install VisualSVN Server 2.5.2& TortoiséVN 1.7.4

VisualSVN Server download link:

httpp://www.visualsvn.com/ficles/VisualSVN-Server-2.5.2.msi

TortoiseSVN download link:

httpp://tortoisesvn.net/downloads.html

Page 20: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Create Repository

Type the name of the repository and select check box if you want to use default structure for the repository

Page 21: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Create User in VisualSVN

Page 22: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

User Authorization Folder or repository On defaulf, everyone can access the

information Right-click on folder or Repository ->

Properties

Page 23: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

User Authorization Permission level:

- Inherit from parent - No access- Read only- Read/Write

Add/Remove: user or group.

Page 24: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

TortoiseSVN – Add, Commit, Update, Delete

Add: add ficle to working copy, it can be transfer to repository the next time commit.

Commit: Commit changes of working copy to repository. Update before. Update: Update the working copy from the repository. Delete: Delete ficle from working copy, the ficle in repository will be delete the

next time commit .

Page 25: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

TortoiseSVN – Check Log

Log of changes of data with revision number, author, date ...

Page 26: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

TortoiseSVN – Revision compares

File: Compare with another revision: TortoiseSVN->Diff Compare with another branch or tag: TortoiseSVN ->Diff with URL Compare between 2 file : Chọn 2 ficle muốn so sánh sau đó chọn TortoiseSVN->Diff

Revision: Compare with another revision : TortoiseSVN->Diff with previous version Compare between 2 revision: use Revision Log, select 2 revision, select Compare

revisions in context menu. Compare working copy with a URL(Branch, ...): hold Shift and right click on ficle or folder,

selectTortoiseSVN->Diff with URL

Page 27: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

File confliicts Mark:<<<<<<< ficlename Your changes ======= Code merged from repository >>>>>>>> revision File: Filename.ext.mine , Filename.ext.rOLDREV, Filename.ext.rNEWREV

Page 28: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Properties - Tree confliict Properties confliicts xảy ra khi 2 hay nhiều developer thay đổi cùng 1 thuộc

tính. Như với ficle content, confliict được giải quyết bởi chính các developer Tree confliicts xảy ra khi developer moved/ renamed/ deleted 1 ficle hay 1

folder mà 1 developer lại chỉnh sửa (move/rename/deleted) nó. Ccos rất nhiều trạng thái khác nhau mà nó sẽ có kết quả là 1 tree Confliict. Và tất cả những điều đó yêu cầu những bước khác nhau để giải quyết đụng độ.

Page 29: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Tạo nhánh

When create a new branch, a new folder will be create on server.

Right-click to Working folder: TortoiseSVN -> Branch/Tag…

Page 30: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

Kết hợp nhánh

Merge a range of revision Reintergrate a branch Merge two diffeerent trees

Page 31: Chapter2: Version Control Student List: Nguyễn Lê Quốc Sơn Huỳnh Hữu Tài Lê Anh Tân Trần Thanh Thiện Trần Hoàng Thịnh

THANK YOUFor Your Time