Tuesday, 27 November 2018

Version control system - Setup and explanation


Subversion Server

Introduction

Subversion is a version control system that keeps track of changes made to files and folders (directories), facilitating data recovery and providing a history of the changes that have been made over time.

What is a version control system?

Version Control System (VCS) is a software that helps software developers to work together and maintain a complete history of their work.
Following are the goals of a Version Control System.
  • Allow developers to work simultaneously.
  • Do not overwrite each other’s changes.
  • Maintain history of every version of everything.
A VCS is divided into two categories.
  • Centralized Version Control System (CVCS), and
  • Distributed/Decentralized Version Control System (DVCS).
We will concentrate only on the Centralized Version Control System and especially Subversion. Subversion falls under centralized version control system, meaning that it uses central server to store all files and enables team collaboration.

Version Control Terminologies

Explanation of common terms in version control system:
  • Repository: A repository is the heart of any version control system. It is the central place where developers store all their work. Repository not only stores files but also the history. Repository is accessed over a network, acting as a server and version control tool acting as a client. Clients can connect to the repository, and then they can store/retrieve their changes to/from repository. By storing changes, a client makes these changes available to other people and by retrieving changes, a client takes other people's changes as a working copy.
  • Trunk: The trunk is a directory where all the main development happens and is usually checked out by developers to work on the project.
  • 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

  • Branches: Branch 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.
  • Working copy: Working copy is a snapshot of the repository. The repository is shared by all the teams, but people do not modify it directly. Instead each developer checks out the working copy. The working copy is a private workplace where developers can do their work remaining isolated from the rest of the team.
  • 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 developers can retrieve these changes by updating their working copy. Commit is an atomic operation. Either the whole commit succeeds or is rolled back. Users never see half finished commit.
 Setup on Personal PC

Requirements :

Three items needed:
  1.  Private key , also sent along this document.
  2. Pageant Software
  3.  Putty
  4.  GIT
  5.  Tortoise GIT
The above two software have a straight forward wizard , follow through.

Configuration.

Enter the below settings on  putty
                     Hostname : 192.168.1.***
                    Port :22
  1. Then navigate to Connection > SSH > Auth
  2. Browse for the private keyissued with this document and set it under the field Private key authentication.
  3. Run the pageant software and add the same key on this software.

Cloning a Repository on the developer server

  1. Create an empty folder anywhere on your Computer.
  2. Right click to give a context menu "SVN Checkout"
  3. Enter the URL of your Repository as svn+ssh://Administrator@MySVNConnection/Order
  4.  Administrator : User login in to the server
  5. MySVNConnection : Name as you have set on your putty software
  6. Order : Name of your project on the developers repository.

Committing changes done to the Repository on the Developers Server

1). Right click on the project, then use SVN Commit -> master as shown below

Then gives you the screen as shown below, enter your comments , select all unversioned files, then use option commit & push as shown below:


Same step is used when updating your project from SVN.
Right click and use SVN Update instead of SVN Commit.
If you commit a file updated and a different programmer updated the file it will show conflicts, that you will need to resolve so you all have the same version on your local PC's as shown :


Click ok , then update
Next screen shows new change and old, choose which to commit.



After choosing the correct changes to update your file, use button Mark as Resolved.Then save, close screen. Then finally commit.
 

Adding a repository for your project.

1). Login to the developer server.
2). Navigate to the location of the repository  (C:\Repository.git)
3). Right click , > Tortoise SVN > Repo-browser
4). Right inside the browser either to add an existing project or a new project as shown below :