Ditributed Version Control System

Preview:

DESCRIPTION

 

Citation preview

Apr 10, 2023 www.ambientia.net 2

DVCS

Distributed version control (systems)

Apr 10, 2023 www.ambientia.net 3

What is DVCS?

Distributed revision control system

or

Distributed version control system

or

Decentralized version control system

or, simply

the greatest thing since sliced bread?

Apr 10, 2023 www.ambientia.net 4

What is Version Control?

• Belongs to Software Configuration Management• Management of changes (over time) to

• Documents• Source code• Web sites (and any other collections of information)

file a

file b

file c

1.0 2.0 2.1 3.0

Apr 10, 2023 www.ambientia.net 5

Traditional VCS

• Centralized• Client-server approach• Single point of failure• Most operations require

network connection• Support for locking

resources

Server

Client

Client

Client

Client

Client

Client

Client

Apr 10, 2023 www.ambientia.net 6

DVCS

• Peer-to-peer, based on the exchange of patches

• Collaboration without common network

• Every working copy is a standalone repository

Client

Client

Client

Client

Client

Client

Client

Client

Client

Client

Client

Client

Client

CI QA Rel.

Apr 10, 2023 www.ambientia.net 7

Basic ConceptsJim Jill

A

repository

Clone A2

repositoryclone

commitchanges

pull

push

Apr 10, 2023 www.ambientia.net 8

TermsRepository A container of assets, e.g. source code. Commonly a directory in a filesystem

containingspecial meta-data about the repository contents (.git and .hg directories).

Working directory The repository contents editable in the filesystem.

Commit, changeset A change applied to the repository contents (multiple files at one) within a transaction.Given a unique identified (a hash code).

Patch A set of commits (one or more) transferred between repositories.

Clone A full copy of another (upstream) repository. The initial copying operation of a repositoryinto another is called cloning.

Push Making changesets from the local repository (source) available in another (destination).

Pull Making changesets from an external repository available locally.

Apr 10, 2023 9www.ambientia.net

Benefits of DVCS

Apr 10, 2023 www.ambientia.net 10

Independence

Bekathwia

Marysol*

Work can progress even when disconnected from the network

Apr 10, 2023 www.ambientia.net 11

Speed

Martin Heigan

Most commonly used operations are extremely fast

Apr 10, 2023 www.ambientia.net 12

Safety

Myrrien

Every working copy is a full backup of the project repository

markjhandel

Apr 10, 2023 www.ambientia.net 13

Flexibility

madprime

Working model is up to the project team

Paul L Dineen

Apr 10, 2023 www.ambientia.net 14

Isolation

ttcopley

Work on new, great ideas now, share the results later

appel

Apr 10, 2023 www.ambientia.net 15

Disadvantages

• Cloning retrieves everything• Uses a lot of bandwidth on the first clone• Might use a lot of disk space as well• Problematic for non-mergeable content

• No support for locking• Locking can be useful for non-mergeable content

• Non-mergeable content?• For example, graphics assets, i.e. large binary files• Always stored in full, for every change

Apr 10, 2023 www.ambientia.net 16

Everything is a Branch

• Working copies• Named branches

• Release branches• Deployment targets

• Light-weight branches• Feature branches• Bug fix branches• Exploratory branches

• Multiple heads in a repository (Mercurial)

FeatheredTar

Apr 10, 2023 www.ambientia.net 17

Branching Model

• Everybody should know:• When to branch; where to

branch from• When to merge; where to

merge back to

• Tailor the model for your environment• Heavy vs. light

• Common model• Git Flow http://nvie.com/posts/a-successful-git-branching-model/

Apr 10, 2023 18www.ambientia.net

Feature Branching

Apr 10, 2023 www.ambientia.net 19

Feature Branching Timeline

feat-X

develop

Pull request

fork

merge changes

merge and remove branch

Apr 10, 2023 www.ambientia.net 20

Steps for Feature Branching

1. Fork a new branch for each individual change

2. Work on and test the branch in isolation

3. Pull changes from the mother branch continuously (keep up-to-date with others)

4. When ready, publish the changes by creating a pull request• Let others review the pull request for quality control

5. Merge the accepted pull request back to the upstream branch (mother branch)

6. Get rid of the (short-lived) feature branch

Apr 10, 2023 www.ambientia.net 21

Pull requests

• Clear point for reviews and quality control• Checklists, formal reviews, performance testing

• Final merge can be done by an integrator (role)• Multiple features/fixes developed in parallel

• Efficiency

• Isolation until final merge• Mainline can maintain high level of quality at all times• No need to delay work due to release preparation• Release from mainline at will

Atlassian Feature Branching

Atlassian DVCS and development flow

Apr 10, 2023 www.ambientia.net 23

Atlassian DVCS support

• JIRA• Feature branch creation for issues

• Stash• Git repository management• Pull requests

• SourceTree• Free (!) repository browser

• Bamboo• Continuous integration• Continuous releasing and/or

deployment

JIRA

SourceTree

Stash

Bamboo

IDE / Editor

www.ambientia.net 24

Branching from JIRA

14.11.2013

www.ambientia.net 25

Checkout from Stash

14.11.2013

Apr 10, 2023 www.ambientia.net 26

SourceTree on developer’s computer

Apr 10, 2023 www.ambientia.net 27

Bamboo branch autodetection, ci

Apr 10, 2023 www.ambientia.net 28

Pull request from SourceTree

www.ambientia.net 29

Code reviews by pull requests

14.11.2013

www.ambientia.net 30

Merging the pull request

14.11.2013

Images Creative Commons-licensed for commercial use

http://creativecommons.org/licenses/by-sa/2.0/legalcode

(The image owners’ Flickr URL attached to each image as a hyperlink)

Images from Flickr

Apr 10, 2023www.ambientia.net 31

Screenshots from Atlassian

tomi.kallio@ambientia.fi

+358 40 749 2051

@tomi_kallio

Tomi Kallio

Apr 10, 2023www.ambientia.net 32

Recommended