20
TFS – VERSION CONTROL VERSION (1.0) MOUDLE NAME VERSION CONTROL SUBMITTED FOR Saudi Post SUBMITTED BY ARCOM

TFS Session 1 : Version Control

Embed Size (px)

Citation preview

TFS – VERSION CONTROL VERSION (1.0)

MOUDLE NAME VERSION CONTROL

SUBMITTED FOR

Saudi Post

SUBMITTED BY

ARCOM

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 2

1. TABLE OF CONTENT

1. TABLE OF CONTENT ................................................................................................................... 2

2. WHAT IS VERSION CONTROL ...................................................................................................... 4

3. BASIC VERSION CONTROL TERMS .............................................................................................. 4

3.1. WORKSPACE .............................................................................................................................. 5

OVERVIEW ................................................................................................................................. 5

DETAILED POINTS ...................................................................................................................... 5

TOOL GUIDELINES ...................................................................................................................... 5

3.2. GET ............................................................................................................................................ 6

OVERVIEW ................................................................................................................................. 6

DETAILED POINTS ...................................................................................................................... 6

TOOL GUIDELINES ...................................................................................................................... 6

3.3. PENDING CHANGES .................................................................................................................... 7

OVERVIEW ................................................................................................................................. 7

DETAILED POINTS ...................................................................................................................... 7

TOOL GUIDELINES ...................................................................................................................... 7

3.4. CHECK-OUT / LOCK .................................................................................................................... 8

OVERVIEW ................................................................................................................................. 8

DETAILED POINTS ...................................................................................................................... 8

TOOL GUIDELINES ...................................................................................................................... 8

3.5. CHECK-IN ................................................................................................................................... 9

OVERVIEW ................................................................................................................................. 9

DETAILED POINTS ...................................................................................................................... 9

TOOL GUIDELINES ...................................................................................................................... 9

3.6. SHELVE ..................................................................................................................................... 10

OVERVIEW ............................................................................................................................... 10

DETAILED POINTS .................................................................................................................... 10

TOOL GUIDELINES .................................................................................................................... 10

3.7. LABEL ....................................................................................................................................... 11

OVERVIEW ............................................................................................................................... 11

DETAILED POINTS .................................................................................................................... 11

TOOL GUIDELINES .................................................................................................................... 11

3.8. VIEW HISTORY ......................................................................................................................... 12

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 3

OVERVIEW ............................................................................................................................... 12

TOOL GUIDELINES .................................................................................................................... 12

3.9. CODE REVIEW .......................................................................................................................... 13

OVERVIEW ............................................................................................................................... 13

DETAILED POINTS .................................................................................................................... 13

TOOL GUIDELINES .................................................................................................................... 13

3.10. BRANCK/MERGE ...................................................................................................................... 14

OVERVIEW ............................................................................................................................... 14

DETAILED POINTS .................................................................................................................... 14

TOOL GUIDELINES .................................................................................................................... 19

3.11. TFS POWER TOOLS (WINDOWS EXPLORER) ............................................................................. 20

OVERVIEW ............................................................................................................................... 20

TOOL GUIDELINES .................................................................................................................... 20

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 4

2. WHAT IS VERSION CONTROL

The major features behind version control are

1. A place to store the source code, images, build scripts, and so on needed to build your

software project

2. The ability to track the history of changes to those files, and to view the state of the file

at various points in the software life cycle

3. Mechanisms and tooling to make it easy to work in parallel with a team of software

developers on the same project

3. BASIC VERSION CONTROL TERMS

There are many terminologies related to version control, will be described as follows

3.1. Workspace

3.2. Get

3.3. Pending changes

3.4. Check-out / lock

3.5. Check-in

3.6. Shelve

3.7. Label

3.8. View History

3.9. Code review

3.10. Branch/merge

3.11. TFS Power tools (windows explorer)

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 5

3.1. WORKSPACE

OVERVIEW

Workspace is your local copy of the team’s codebase

Place where develop and test your code

Provide isolation until you are ready to check in your work

WORKING FOLDER: Map server path to local path

DETAILED POINTS

There are two types of workspaces as follows:

SERVER WORKSPACE LOCAL WORKSPACE

Old concept in TFS 2010 and before New concept since TFS 2012

All files on the local machine are

marked as "Read Only" until checked

out for modification from VStudio or

Eclipse

You can edit files when offline from

TFS without checkout

Can't edit file outside TFS, before it

need to get checkout

You can edit outside VStudio or

Eclipse using like notepad

metadata saved in server metadata saved in local machine

TOOL GUIDELINES

1. Create/edit workspace

2. Working folder status (active – cloaked)

3. Map to local folder

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 6

3.2. GET

OVERVIEW

Download files from a version control repository to your local system

When you get files from version control you can do one of two things:

Get Latest version or get specific version

DETAILED POINTS

A. GET SPECIFIC VERSION:

Get specific version from source control item according to type

Changeset

Date

Label

Workspace version

Override options after take your version

TOOL GUIDELINES

4. Get latest version

5. Get specific version by Changeset and use override

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 7

3.3. PENDING CHANGES

OVERVIEW

If you make changes to the files in your workspace, you are building up

a list of pending changes

Any changes you make (edits, adds, deletes, undeletes, renames,

moves, branches, merges, and so on) are stored as pending changes in

your workspace

DETAILED POINTS

PENDING CHANGES:

Pending changes results can be maintained by

Check- in

Shelve

undo

TOOL GUIDELINES

6. Add items to folder

7. Edit file in source control; show edit pending

8. Undo pending changes

9. Action undo all

10. Delete item in source control

11. Show deleted items in source control explorer

12. Undelete items

13. Move file to other location in source control

14. Rename file in source control

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 8

3.4. CHECK-OUT / LOCK

OVERVIEW

Check-out mean take item exclusive to work on it

Lock used for temporary prevent users to make change to file or folder

DETAILED POINTS

1. Check out concept needed more in server than local workspace

CHECK-OUT (SERVER WS) CHECK-OUT (LOCAL WS)

Files in your workspace would be

read-only

if a file modified on local system,

the file is marked as having a

pending edit (check-out)

You must check out the files, before

you start edit

No need to explicitly check out a

file,

2. Lock can be two types of locks

CHECK-OUT LOCK CHECK-IN LOCK

In server work space only Local and server workspace

prevents other users from checking

out the locked file while you hold the

check-out lock

Allow other users to edit locked file, but

they can't check in it

may be used for major or complex

revision on file and need no one else

make any changes

guarantee that you will have the right of

first check-in.

TOOL GUIDELINES

15. Convert between local-server workspace, see changes in check-out

16. Convert between local-server workspace, see changes in lock

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 9

3.5. CHECK-IN

OVERVIEW

Check-in mean update pending changes to version control repository

While perform Check-in you can have set of operations like

check-in policies, check-in notes, comments, include/exclude changes

DETAILED POINTS

A. CHECK-IN

More one person can edit for same file

First check-in has no problem; others will find conflict, needed to merge

B. CHECK-IN POLICY:

define policy that will be applied while check in

Policy can be one of 4 types

Changeset comment

Build

Work item

Code analysis

C. CHECK-IN NOTES:

Define notes that will be fulfilled while check in

Define whether note is required or not

D. CHANGESET:

set of files and work items associated together in same time of check in

Changeset can provide useful information like:

which files were changed

what the exact changes were

who changed the files

what the check-in comment contains

which work items are associated with the Changeset

which policy warnings appeared

TOOL GUIDELINES

17. Add check in policy – related to work item policy

18. Add check in notes

19. Include, exclude changes to check in

20. Find Changeset after check-in

21. Conflict, merge (auto – merge-tool – take server – take local)

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 10

3.6. SHELVE

OVERVIEW

store the changes on server without committing those changes to the

main code that the rest of the team is working on

save progress on a particularly large change

share a set of changes with a colleague on a different machine

DETAILED POINTS

A. SHELVING

Set of pending changes saved to server in Changeset

shelveset is uniquely identified by the owner and a name given

Shelveset share much in common with Changeset

Shelveset with same name will override the old content

Shelveset can be fully deleted and can't be undelete

Shelveset can be unshelve to share your changes

Unshelve can be done for different workspace, different machine

TOOL GUIDELINES

22. Shelve

23. Find Shelveset

24. Unshelve

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 11

3.7. LABEL

OVERVIEW

Labels let you take a snapshot of your files

Label to the folder, branch, or team project that contains the files

you can view, build, or even roll back a large set of files to the state

they were in when you applied the label, or rollback to label

DETAILED POINTS

A. when code has reached a reasonable level of quality and stability, team

will build and release a new version of the product, so team need to

mark current version to still able to get, build if any changes happened

TOOL GUIDELINES

25. Apply label

26. Find label

27. Edit label – add item to label

28. Delete label

29. Get specific version by label

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 12

3.8. VIEW HISTORY

OVERVIEW

View history about item, show all versions and compare between

versions and override current version with selected history version

View history in term of Changeset or label

TOOL GUIDELINES

30. View history

31. Compare

32. Get this version

33. Rollback

34. Request review

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 13

3.9. CODE REVIEW

OVERVIEW

formal or informal reviews of code by a lead or peer developer before a

developer checks in his or her source code changes

DETAILED POINTS

A. CODE REVIEW USED FOR REIEW TYPES LIKE:

Best practices

Potential bugs

Performance

Security threats

Following internal coding standards

Previous code review suggested changes

TOOL GUIDELINES

35. Request code review

36. code review comments

37. close review

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 14

3.10. BRANCK/MERGE

OVERVIEW

Branch is a copy of a set of files in a different part of the repository

Allows two or more teams of people to work on the same part of a project in parallel

Merge target branch back to source branch after finish work in branch

DETAILED POINTS

A. BRANCH STRATEGIES

1. NO BRANCH

team works only from the main source tree

don't need branches, you do not need isolation.

generally, for small or medium size teams

no isolation for team or features or release

My Team Project

└ Main

└ Source

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 15

2. BRANCH FOR RELEASE

creates branches to support an ongoing release.

The most common branching technique

create branch before release time to stabilize the release and then merges changes from the release branch

back into the main source tree after the software is released

My Team Project

└ Main → Main integration branch

│ └ Source

└ Releases

└ Release 1 → Release branch

└ Source

└ Release 2 → Release branch

└ Source

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 16

3. CODE PROMOTION BRANCH

creates branches to support an ongoing release.

The most common branching technique

create branch before release time to stabilize the release and then merges changes from the

release branch back into the main source tree after the software is released

My Team Project

└ Main → Main integration branch

│ └ Source

└ Releases

└ Test → Release branch

└ Source

└ Prod → Release branch

└ Source

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 17

4. BRANCH FOR FEATURE

All features for that release are developed in parallel

build can be deployed only when all features in flight have been completed and tested

perform work in the development branch (feature branch) then merge back into your main source

My Team Project

└ Main → Main integration branch

│ └ Source

└ Feature

└ F1 → Feature branch

└ Source

└ F2 → Feature branch

└ Source

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 18

5. BRANCH FOR TEAM

similar to branch‐by‐feature with little difference

organize your development branches according to sub‐team, not product feature

may be one‐to‐one correspondence between team and feature, but in some cases a team might work

on multiple features

My Team Project

└ Development → Isolated development branch container

│ └ Team 1 → Team branch

│ │ └ Feature A → Isolated branch for development

│ │ │ └ Source

│ │ └ Feature B → Isolated branch for development

│ │ └ Source

│ │

│ └ Team 2 → Team branch

│ └ Feature A → Isolated branch for development

│ │ └ Source

│ └ Feature B → Isolated branch for development

│ └ Source

└ Main → Main Integration branch

└ Source

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 19

TOOL GUIDELINES

38. Create code promotion branch

39. Merge branch

TFS COURSE – VERSION CONTROL MODULE

البريد السعودي – 2محاضرة

TFS – VERSION CONTROL Page | 20

3.11. TFS POWER TOOLS (WINDOWS EXPLORER)

OVERVIEW

Help to make most of version control concepts in windows explorer for

files or folders located in workspace

TOOL GUIDELINES

1. Add new file – check in

2. Get selected item, get entire workspace