SlideShare une entreprise Scribd logo
1  sur  45
Télécharger pour lire hors ligne
Versioning for developers
            Michelangelo van Dam
   Macq Electronique 2010 Brussels, Belgium
Michelangelo van Dam

• Independent Consultant
• Zend Certified Engineer (ZCE)
 - PHP 4 & PHP 5
 - Zend Framework
• Co-Founder of PHPBenelux
• Shepherd of “elephpant” herds
T AIL O RM A D E S O L U T I O N S




                                         Macq électronique, manufacturer and developer, proposes
                                         you a whole series of electronic and computing-processing
                                         solutions for industry, building and road traffic.

                                         Macq électronique has set itself two objectives which are
                                         essential for our company :

                                              developing with competence and innovation
                                              earning the confidence of our customers

                                         Macq électronique presents many references carried out
                                         the last few years which attest to its human and
                                         technical abilities to meet with the greatest efficiency
                                         the needs of its customers.




For more information, please check out our website
              http://www.macqel.eu
About this presentation
• Concepts of version control
• Management with subversion
• Life cycle of a project in subversion
• Parts and structures within subversion
• Advanced subversion tools
• New in release 1.5
What is version control ?


“Revision control (also known as version control ...) is
the management of multiple revisions of the same unit
of information.”
(source: Wikipedia:RevisionControl)
Versioning for developers
•- version control provides
    management of versions of information
   • code/tests
   • configuration files
 -
   • documentation
     in a structured, standardized way
 -   with repositories
     • centralized (SVN, CVS)
     • decentralized (GIT)
Why need versioning ?
• enables collaboration between developers
• centralized “main code” (trunk)
• custom code alongside main code (branching)
• eases release management (tags)
• rollback to previous revisions
• integration with other tools
Subversion (SVN)
• Subversion (http://subversion.tigris.org)
• more advanced than CVS
• less complex than GIT
• integrates well with other tools
  (trac, gforge, jira, ...)
• supported by many tools
  (Zend Studio, TortoiseSVN, Subversion CLI)
An example project in trac
SVN browser Zend Studio
Code managing with SVN
• many developers create much code
•- code is committed to a central repository
    conflicts trigger warnings
• user and groups can be defined
• different versions can co-exist
• access management for named and anonymous
  access rights
Subversion authentication
• svnserve server
  $ svn svn://server/project/trunk
• svnserve server over SSH
  $ svn svn+ssh://server/project/trunk
• Apache webserver
  http://svn.server/project/trunk
Version management
• all code resides in “trunk”
• code revisions are detached in “branches”
• snapshots for releases are “tagged”
Subversion Schema
Putting a project into SVN
Say you’ve started project FooBar with following files:
/FooBar
   /Foo.php
   /Bar.php

To put it on a Subversion repository:
$ svn import -m “new project” FooBar http://svn.server/
FooBar/trunk
Getting code from SVN
A new team member needs to work on the FooBar project

He needs to get the project from Subversion

To get it from a Subversion repository:
$ svn checkout http://svn.server/FooBar/trunk FooBar

This will fetch the latest revision (HEAD) from the TRUNK
and creates a local FooBar directory
Updating code in SVN
After a well deserved holiday, you need to continue working
on the FooBar project

You need to get updates of the project from Subversion

To update your working copy from Subversion repository:
$ svn update /FooBar

This will update your working copy with the latest revision
(HEAD) from the TRUNK
Committing back to SVN
You’re working hard on FooBar and you need to commit
your changes back to Subversion.

To commit changes back to Subversion repository:
$ svn commit -m “Added some cool stuff”

This will commit changes in your code to the TRUNK.
Best practice


   Update before committing
    Update after committing
Commit small development chunks
        Commit often
Release management
• a release is a snapshot of a version branch
• are being deployed to server environments
   (DEV, TEST, ACC, PROD, ...)
•- 2 common methods to release code
     symlink deployment
 -   subversion export
Symlink Deployment
•- On production server(s):
   use release folders
   svn co svn://server/myproj/tags/rel-1.0 /web/
   myproj-rel-1.0
 - create symlink to it
   ln -s /web/myproj-rel-1.0 /web/myproj
• Pro:
 - simple
• Contra:
 - renaming folders on server
 - enabling FollowSymlinks
Subversion Export
• Exporting a release from subversion
  svn export http://svn.server/project/tags/
  release-1.0.2
• Pro:
 - scheduled (automated) upgrades possible
 - no further modifications necessary
• Contra:
 - takes longer to switch back to previous release
SVN life cycle
                        feature branch

        v1.0 v1.1
Trunk
                                         bug fix

                            rel-1.1.1       rel-1.1.2

                    rel-1.0.1       rel-1.0.2
Trunk
•- trunk is where all code resides
     except custom development
• has always the latest version
• is not always the most stable version
Branch
•- two kind of branches exists
     feature branches
 -   release branches
Feature Branches
• code that changes many things in trunk
• are best put in a separate branch
• maintained by their developer(s)
•- and merged back into trunk
    after the merge, the branch is removed
• when changes are done and tested
Release Branches
• are maintained in branches
• have a long lifetime cycle (several years)
•- differ from each other
    because of new code base, framework, language
• have a common base = trunk
• fixes from versions go into trunk
• back port fixes go from trunk into version
Tags
• tags are snapshots
• usually made on version branches
• can also be made on “trunk”
• are deployed to server environments
• are used to keep track what’s happened between
  releases (change log)
More than just versioning
•- Subversion provides more features
     File portability
 -   Keyword substitution
 -   Locking
 -   Externals
 -   Peg and Operative revisions
 -   Network model
 -   Hooks
File portability
•- Line endings differ on different OS’s
     are ignored when checking modifications
•- Mime-types differ from their extensions
    binary and non-binary files are tested on content
Keyword substitution
•- Only a few keywords are substituted
     $Date:$ › $Date: 2008-10-22 20:00:00 +0100
     (Wed, 22 Oct 2008) $
 -   $Revision:$ › $Revision: 144 $
 -   $Author:$ › $Author: svnusername $
 -   $HeadUrl:$ › $HeadUrl: http://svn.test.be/trunk $
 -   $Id:$ › $Id: file.php 148 2008-10-22 20:00:00Z
     svnusername $
Locking
•- working copy locks
   exclusive right to a working copy
 - clears with “svn cleanup”
• database locks
 - ensures database integrity
 - only admins can remove this lock

• conflicts with the purpose of revision control
Externals
•- Externals provide an easy way to
   include other internal or external projects
 - without having to care about their revisions
• Examples:
 - Zend Framework as svn:externals on library path
 - project that includes many smaller projects
Peg & Operative revisions
•- automated handling of
   moving files
 - deleting and creating new files with same name
• Using specific syntax
 - $ svn command -r OPERATIVE-REV item@PEG-
   REV
Network model
•- Can run its own svnserve
   pros: no dependencies, works with ssh for extra
   security
 - contras: need svnclient to connect
• Or in combination with Apache webserver
 - pros: works with any http-client
 - contras: overkill for small projects, requires
   mod_dav_svn, more difficult to set up
Hooks
•- Hooks facilitate actions to be taken
   before a commit starts (validate rights)
 - after a commit (send e-mail, update tracker, ...)
 - before or after a revision change (notifications)
• Can easily be incorporated with tools
 - tracking tools
 - integration tools (Lorna Jane’s Nabaztag)
 - mailing and logging systems
Hooks execute moments
•- basic commit moments:
    start-commit:
   • runs before commit transaction started
 - pre-commit:
   • runs right before commit transaction is
        promoted
 -   post-commit:

 -
   •    runs after the commit transaction is finished
     ...
Cool things w/ SVN hooks
   Lorna Jane’s Nabaztag
                     Responding on SVN commits




http://www.flickr.com/photos/lornajane/2592602734/
Automated builds
•- With SVN and Phing (PHP Build tool)
     nightly checkout of code base
 -   running tools to enhance code
   •  PHPDocumentator (automated API docs)
   •  PHP_CodeSniffer (checks code for standards)
   •  PHPLint (checks code for syntax errors)
   •  PHPUnit (unit testing for PHP)

 -
   •  …
     creating a package (including docs, tests, reports)
New features in SVN v1.5
• Merge tracking (foundational)
• Sparse checkouts (via new --depth option)
• Interactive conflict resolution
• Changelist support
• Relative URLs, peg revisions in svn:externals
• Cyrus SASL support for ra_svn and svnserve
• ... (more on http://subversion.tigris.org/
  svn_1.5_releasenotes.html)
Summary
• manageable file change history
• better collaboration between developers
• clearer release management
• more than one version of same code base
• easier to rollback in case of emergency
Recommended Reading
  Version Control with Subversion, 2nd Edition
  (O’Reilley Media, Inc)

  by C. Michael Pilato; Ben Collins-Sussman; Brian W. Fitzpatrick

  also online: http://svnbook.red-bean.com




  Managing Software Development with Trac and Subversion
  (Packt Publishing)

  by David J Murphy
Recommended Reading
  Subversion Version Control:
  Using the Subversion Version Control System in Development Projects
  (Bruce Perens' Open Source Series)

  by William Nagel
Credits


                    Wikipedia Logo
http://commons.wikimedia.org/wiki/File:Wikipedia-logo.png
Thank you !


         Slides on Slideshare
http://www.slideshare.net/group/macqel

      Give feedback on Joind.in
         http://joind.in/1260

Contenu connexe

Tendances

SVN Usage & Best Practices
SVN Usage & Best PracticesSVN Usage & Best Practices
SVN Usage & Best Practices
Ashraf Fouad
 
Ankit Chohan - Java
Ankit Chohan - JavaAnkit Chohan - Java
Ankit Chohan - Java
Ankit Chohan
 
SVN Best Practices
SVN Best PracticesSVN Best Practices
SVN Best Practices
abackstrom
 

Tendances (20)

Atril-Déjà Vu Tea mserver 2 general presentation
Atril-Déjà Vu Tea mserver 2   general presentationAtril-Déjà Vu Tea mserver 2   general presentation
Atril-Déjà Vu Tea mserver 2 general presentation
 
Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2
 
Version Control with Subversion
Version Control with SubversionVersion Control with Subversion
Version Control with Subversion
 
SVN Usage & Best Practices
SVN Usage & Best PracticesSVN Usage & Best Practices
SVN Usage & Best Practices
 
Part 4 - Managing your svn repository using jas forge
Part 4  - Managing your svn repository using jas forgePart 4  - Managing your svn repository using jas forge
Part 4 - Managing your svn repository using jas forge
 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovsky
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best Practices
 
svn
svnsvn
svn
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
 
Pipeline based deployments on Jenkins
Pipeline based deployments  on JenkinsPipeline based deployments  on Jenkins
Pipeline based deployments on Jenkins
 
Svn Basic Tutorial
Svn Basic TutorialSvn Basic Tutorial
Svn Basic Tutorial
 
Ankit Chohan - Java
Ankit Chohan - JavaAnkit Chohan - Java
Ankit Chohan - Java
 
Jenkins Declarative Pipelines 101
Jenkins Declarative Pipelines 101Jenkins Declarative Pipelines 101
Jenkins Declarative Pipelines 101
 
Testing fácil con Docker: Gestiona dependencias y unifica entornos
Testing fácil con Docker: Gestiona dependencias y unifica entornosTesting fácil con Docker: Gestiona dependencias y unifica entornos
Testing fácil con Docker: Gestiona dependencias y unifica entornos
 
SVN Basics
SVN BasicsSVN Basics
SVN Basics
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShift
 
SVN Best Practices
SVN Best PracticesSVN Best Practices
SVN Best Practices
 
BKK16-205 RDK-B IoT
BKK16-205 RDK-B IoTBKK16-205 RDK-B IoT
BKK16-205 RDK-B IoT
 
SUSE KVM Ecosystem
SUSE KVM EcosystemSUSE KVM Ecosystem
SUSE KVM Ecosystem
 
What is the merge window?
What is the merge window?What is the merge window?
What is the merge window?
 

En vedette

Quick Introduction to git
Quick Introduction to gitQuick Introduction to git
Quick Introduction to git
Joel Krebs
 

En vedette (10)

Distributed Version Control Systems in the Enterprise - Atlassian Summit 2010
Distributed Version Control Systems in the Enterprise - Atlassian Summit 2010Distributed Version Control Systems in the Enterprise - Atlassian Summit 2010
Distributed Version Control Systems in the Enterprise - Atlassian Summit 2010
 
Subversion
SubversionSubversion
Subversion
 
A brief introduction to version control systems
A brief introduction to version control systemsA brief introduction to version control systems
A brief introduction to version control systems
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
What is version control software and why do you need it?
What is version control software and why do you need it?What is version control software and why do you need it?
What is version control software and why do you need it?
 
Intro To Git
Intro To GitIntro To Git
Intro To Git
 
Alfresco in an hour
Alfresco in an hourAlfresco in an hour
Alfresco in an hour
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version Control
 
Quick Introduction to git
Quick Introduction to gitQuick Introduction to git
Quick Introduction to git
 

Similaire à Versioning for Developers

Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With Subversion
Samnang Chhun
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
dotCloud
 

Similaire à Versioning for Developers (20)

Continuous Integration for OpenVMS with Jenkins
Continuous Integration for OpenVMS with JenkinsContinuous Integration for OpenVMS with Jenkins
Continuous Integration for OpenVMS with Jenkins
 
Version Control and Continuous Integration
Version Control and Continuous IntegrationVersion Control and Continuous Integration
Version Control and Continuous Integration
 
SQL Server DevOps Jumpstart
SQL Server DevOps JumpstartSQL Server DevOps Jumpstart
SQL Server DevOps Jumpstart
 
Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With Subversion
 
Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...
Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...
Continuous Deployment into the Unknown with Artifactory, Bintray, Docker and ...
 
Source control - what you need to know
Source control - what you need to knowSource control - what you need to know
Source control - what you need to know
 
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
Habitat talk at CodeMonsters Sofia, Bulgaria Nov 27 2018
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
 
Mantis Code Deployment Process
Mantis Code Deployment ProcessMantis Code Deployment Process
Mantis Code Deployment Process
 
223: Modernization and Migrating from the ESB to Containers
223: Modernization and Migrating from the ESB to Containers223: Modernization and Migrating from the ESB to Containers
223: Modernization and Migrating from the ESB to Containers
 
OpenStack Summit
OpenStack SummitOpenStack Summit
OpenStack Summit
 
Magento 2 Workflows
Magento 2 WorkflowsMagento 2 Workflows
Magento 2 Workflows
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
 
Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)
Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)
Deep Dive into the Microsoft OpenStack CI Infrastructure (Alessandro Pilotti)
 
321 codeincontainer brewbox
321 codeincontainer brewbox321 codeincontainer brewbox
321 codeincontainer brewbox
 
Open Audit
Open AuditOpen Audit
Open Audit
 
Fluo CICD OpenStack Summit
Fluo CICD OpenStack SummitFluo CICD OpenStack Summit
Fluo CICD OpenStack Summit
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
 
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
Facilitating continuous delivery in a FinTech world with Salt, Jenkins, Nexus...
 

Plus de Michelangelo van Dam

Zf2 how arrays will save your project
Zf2   how arrays will save your projectZf2   how arrays will save your project
Zf2 how arrays will save your project
Michelangelo van Dam
 

Plus de Michelangelo van Dam (20)

GDPR Art. 25 - Privacy by design and default
GDPR Art. 25 - Privacy by design and defaultGDPR Art. 25 - Privacy by design and default
GDPR Art. 25 - Privacy by design and default
 
Moving from app services to azure functions
Moving from app services to azure functionsMoving from app services to azure functions
Moving from app services to azure functions
 
Privacy by design
Privacy by designPrivacy by design
Privacy by design
 
DevOps or DevSecOps
DevOps or DevSecOpsDevOps or DevSecOps
DevOps or DevSecOps
 
Privacy by design
Privacy by designPrivacy by design
Privacy by design
 
Continuous deployment 2.0
Continuous deployment 2.0Continuous deployment 2.0
Continuous deployment 2.0
 
Let your tests drive your code
Let your tests drive your codeLet your tests drive your code
Let your tests drive your code
 
General Data Protection Regulation, a developer's story
General Data Protection Regulation, a developer's storyGeneral Data Protection Regulation, a developer's story
General Data Protection Regulation, a developer's story
 
Leveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantageLeveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantage
 
The road to php 7.1
The road to php 7.1The road to php 7.1
The road to php 7.1
 
Open source for a successful business
Open source for a successful businessOpen source for a successful business
Open source for a successful business
 
Decouple your framework now, thank me later
Decouple your framework now, thank me laterDecouple your framework now, thank me later
Decouple your framework now, thank me later
 
Deploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutesDeploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutes
 
Azure and OSS, a match made in heaven
Azure and OSS, a match made in heavenAzure and OSS, a match made in heaven
Azure and OSS, a match made in heaven
 
Getting hands dirty with php7
Getting hands dirty with php7Getting hands dirty with php7
Getting hands dirty with php7
 
Zf2 how arrays will save your project
Zf2   how arrays will save your projectZf2   how arrays will save your project
Zf2 how arrays will save your project
 
Create, test, secure, repeat
Create, test, secure, repeatCreate, test, secure, repeat
Create, test, secure, repeat
 
The Continuous PHP Pipeline
The Continuous PHP PipelineThe Continuous PHP Pipeline
The Continuous PHP Pipeline
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsPHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the tests
 
Easily extend your existing php app with an api
Easily extend your existing php app with an apiEasily extend your existing php app with an api
Easily extend your existing php app with an api
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Versioning for Developers

  • 1. Versioning for developers Michelangelo van Dam Macq Electronique 2010 Brussels, Belgium
  • 2. Michelangelo van Dam • Independent Consultant • Zend Certified Engineer (ZCE) - PHP 4 & PHP 5 - Zend Framework • Co-Founder of PHPBenelux • Shepherd of “elephpant” herds
  • 3. T AIL O RM A D E S O L U T I O N S Macq électronique, manufacturer and developer, proposes you a whole series of electronic and computing-processing solutions for industry, building and road traffic. Macq électronique has set itself two objectives which are essential for our company : developing with competence and innovation earning the confidence of our customers Macq électronique presents many references carried out the last few years which attest to its human and technical abilities to meet with the greatest efficiency the needs of its customers. For more information, please check out our website http://www.macqel.eu
  • 4. About this presentation • Concepts of version control • Management with subversion • Life cycle of a project in subversion • Parts and structures within subversion • Advanced subversion tools • New in release 1.5
  • 5. What is version control ? “Revision control (also known as version control ...) is the management of multiple revisions of the same unit of information.” (source: Wikipedia:RevisionControl)
  • 6. Versioning for developers •- version control provides management of versions of information • code/tests • configuration files - • documentation in a structured, standardized way - with repositories • centralized (SVN, CVS) • decentralized (GIT)
  • 7. Why need versioning ? • enables collaboration between developers • centralized “main code” (trunk) • custom code alongside main code (branching) • eases release management (tags) • rollback to previous revisions • integration with other tools
  • 8. Subversion (SVN) • Subversion (http://subversion.tigris.org) • more advanced than CVS • less complex than GIT • integrates well with other tools (trac, gforge, jira, ...) • supported by many tools (Zend Studio, TortoiseSVN, Subversion CLI)
  • 11. Code managing with SVN • many developers create much code •- code is committed to a central repository conflicts trigger warnings • user and groups can be defined • different versions can co-exist • access management for named and anonymous access rights
  • 12. Subversion authentication • svnserve server $ svn svn://server/project/trunk • svnserve server over SSH $ svn svn+ssh://server/project/trunk • Apache webserver http://svn.server/project/trunk
  • 13. Version management • all code resides in “trunk” • code revisions are detached in “branches” • snapshots for releases are “tagged”
  • 15. Putting a project into SVN Say you’ve started project FooBar with following files: /FooBar /Foo.php /Bar.php To put it on a Subversion repository: $ svn import -m “new project” FooBar http://svn.server/ FooBar/trunk
  • 16. Getting code from SVN A new team member needs to work on the FooBar project He needs to get the project from Subversion To get it from a Subversion repository: $ svn checkout http://svn.server/FooBar/trunk FooBar This will fetch the latest revision (HEAD) from the TRUNK and creates a local FooBar directory
  • 17. Updating code in SVN After a well deserved holiday, you need to continue working on the FooBar project You need to get updates of the project from Subversion To update your working copy from Subversion repository: $ svn update /FooBar This will update your working copy with the latest revision (HEAD) from the TRUNK
  • 18. Committing back to SVN You’re working hard on FooBar and you need to commit your changes back to Subversion. To commit changes back to Subversion repository: $ svn commit -m “Added some cool stuff” This will commit changes in your code to the TRUNK.
  • 19. Best practice Update before committing Update after committing Commit small development chunks Commit often
  • 20. Release management • a release is a snapshot of a version branch • are being deployed to server environments (DEV, TEST, ACC, PROD, ...) •- 2 common methods to release code symlink deployment - subversion export
  • 21. Symlink Deployment •- On production server(s): use release folders svn co svn://server/myproj/tags/rel-1.0 /web/ myproj-rel-1.0 - create symlink to it ln -s /web/myproj-rel-1.0 /web/myproj • Pro: - simple • Contra: - renaming folders on server - enabling FollowSymlinks
  • 22. Subversion Export • Exporting a release from subversion svn export http://svn.server/project/tags/ release-1.0.2 • Pro: - scheduled (automated) upgrades possible - no further modifications necessary • Contra: - takes longer to switch back to previous release
  • 23. SVN life cycle feature branch v1.0 v1.1 Trunk bug fix rel-1.1.1 rel-1.1.2 rel-1.0.1 rel-1.0.2
  • 24. Trunk •- trunk is where all code resides except custom development • has always the latest version • is not always the most stable version
  • 25. Branch •- two kind of branches exists feature branches - release branches
  • 26. Feature Branches • code that changes many things in trunk • are best put in a separate branch • maintained by their developer(s) •- and merged back into trunk after the merge, the branch is removed • when changes are done and tested
  • 27. Release Branches • are maintained in branches • have a long lifetime cycle (several years) •- differ from each other because of new code base, framework, language • have a common base = trunk • fixes from versions go into trunk • back port fixes go from trunk into version
  • 28. Tags • tags are snapshots • usually made on version branches • can also be made on “trunk” • are deployed to server environments • are used to keep track what’s happened between releases (change log)
  • 29. More than just versioning •- Subversion provides more features File portability - Keyword substitution - Locking - Externals - Peg and Operative revisions - Network model - Hooks
  • 30. File portability •- Line endings differ on different OS’s are ignored when checking modifications •- Mime-types differ from their extensions binary and non-binary files are tested on content
  • 31. Keyword substitution •- Only a few keywords are substituted $Date:$ › $Date: 2008-10-22 20:00:00 +0100 (Wed, 22 Oct 2008) $ - $Revision:$ › $Revision: 144 $ - $Author:$ › $Author: svnusername $ - $HeadUrl:$ › $HeadUrl: http://svn.test.be/trunk $ - $Id:$ › $Id: file.php 148 2008-10-22 20:00:00Z svnusername $
  • 32. Locking •- working copy locks exclusive right to a working copy - clears with “svn cleanup” • database locks - ensures database integrity - only admins can remove this lock • conflicts with the purpose of revision control
  • 33. Externals •- Externals provide an easy way to include other internal or external projects - without having to care about their revisions • Examples: - Zend Framework as svn:externals on library path - project that includes many smaller projects
  • 34. Peg & Operative revisions •- automated handling of moving files - deleting and creating new files with same name • Using specific syntax - $ svn command -r OPERATIVE-REV item@PEG- REV
  • 35. Network model •- Can run its own svnserve pros: no dependencies, works with ssh for extra security - contras: need svnclient to connect • Or in combination with Apache webserver - pros: works with any http-client - contras: overkill for small projects, requires mod_dav_svn, more difficult to set up
  • 36. Hooks •- Hooks facilitate actions to be taken before a commit starts (validate rights) - after a commit (send e-mail, update tracker, ...) - before or after a revision change (notifications) • Can easily be incorporated with tools - tracking tools - integration tools (Lorna Jane’s Nabaztag) - mailing and logging systems
  • 37. Hooks execute moments •- basic commit moments: start-commit: • runs before commit transaction started - pre-commit: • runs right before commit transaction is promoted - post-commit: - • runs after the commit transaction is finished ...
  • 38. Cool things w/ SVN hooks Lorna Jane’s Nabaztag Responding on SVN commits http://www.flickr.com/photos/lornajane/2592602734/
  • 39. Automated builds •- With SVN and Phing (PHP Build tool) nightly checkout of code base - running tools to enhance code • PHPDocumentator (automated API docs) • PHP_CodeSniffer (checks code for standards) • PHPLint (checks code for syntax errors) • PHPUnit (unit testing for PHP) - • … creating a package (including docs, tests, reports)
  • 40. New features in SVN v1.5 • Merge tracking (foundational) • Sparse checkouts (via new --depth option) • Interactive conflict resolution • Changelist support • Relative URLs, peg revisions in svn:externals • Cyrus SASL support for ra_svn and svnserve • ... (more on http://subversion.tigris.org/ svn_1.5_releasenotes.html)
  • 41. Summary • manageable file change history • better collaboration between developers • clearer release management • more than one version of same code base • easier to rollback in case of emergency
  • 42. Recommended Reading Version Control with Subversion, 2nd Edition (O’Reilley Media, Inc) by C. Michael Pilato; Ben Collins-Sussman; Brian W. Fitzpatrick also online: http://svnbook.red-bean.com Managing Software Development with Trac and Subversion (Packt Publishing) by David J Murphy
  • 43. Recommended Reading Subversion Version Control: Using the Subversion Version Control System in Development Projects (Bruce Perens' Open Source Series) by William Nagel
  • 44. Credits Wikipedia Logo http://commons.wikimedia.org/wiki/File:Wikipedia-logo.png
  • 45. Thank you ! Slides on Slideshare http://www.slideshare.net/group/macqel Give feedback on Joind.in http://joind.in/1260