SlideShare a Scribd company logo
1 of 116
Version Control with
Subversion

              Kent Wang
              Sep 27, 2011
Sometimes there’s a single right way to
do things; Sometimes there are many
Agenda
• Overview
• Fundamental Concepts
• Basic Usage
• Advanced Topics
• Branching and Merging
• Appendix: Bubble-Up Method
Overview
What is Subversion?

• Version control system (VCS)
• Centralized
• Free & Open Source (Apache License)
History
History

• Early 2000, began in CollabNet, Inc.
• May 2000, detailed design began
• Aug 31, 2001 , “Self-hosting”
• Early 2010, integrated into ASF
Architecture
command-line client app                        GUI client apps
                                                                   client
                                                                 interface
                           Client Library
   Working Copy
 Management Library
                          Repository Access
                       DAV       SVN          Local

       Apache
      mode_dav
                               svnserve
     mod_dav_svn

                                                                 repository
                                                                  interface

                   Subversion Repository

    Berkeley DB                             FSFS
Fundamental Concepts
Version Control Basics
                              Repository




• The Repository
• The Working Copy
                     Client     Client     Client
Version Control Basics

• Versioning Models
 - The problem of file sharing
 - The lock-modify-unlock solution
 - The copy-modify-merge solution
The problem of sharing
Lock-modify-unlock
Copy-modify-merge
Copy-modify-merge
Subversion Way

• Subversion Repositories
• Addressing the Repository
• Revisions
Revisions
0
Revisions
0   1        2      3
Subversion Way

• Working copies
 - How the working copy works
 - Disposing of a Working Copy
 - Administrative directory
 - Mixed-revision
Subversion Way

• Working copies
 - How the working copy works                  at e!
 - Disposing of a Working Copy re sep       ar

 - Administrative directory           it sa
                                    m
                               c om
 - Mixed-revision
                      te sa
                            nd
                     p da
                    U
Basic Usage
Help!


• svn help
• svn help subcommand
Importing
 • Working copy not required
 • Files are immediately committed to the
     repository
 • Original local directory not converted into
     a working copy

$ svn import unversioned-directory 
       http://svn.example.com/repos/trunk/magic
Create a working copy

 • Create a working copy on local machine
 • Every directory in a working copy contains
    an .svn subdirectory


$ svn checkout http://svn.example.com/repos/trunk/magic
                  working-copy
Basic Work Cycle
• Update your working copy
• Make your changes
• Review your changes
• Fix your mistakes
• Resolve any conflicts
• Publish (commit) your changes
Update working copy

 • Update to specified revision with -r
 • Commit new changes to out-of-date files
     and directories is not allowed by svn


$ cd working-copy
$ svn update
Make your change
• File changes
 - Make changes using what ever tools
 - Svn automatically detects file changes
• Tree changes
 - Changes to a directory’s structure
 - Use svn operations to “schedule”
Review Your Changes

• Subcommand: status diff revert
• Without Network
Review Your Changes

• Subcommand: status diff revert
• Without Network
• Subversion keeping private caches of
  pristine versions in .svn/text-base/
Review Your Changes


• Overview of your changes with svn status
• --show-updates(-u) --verbose(-v) --no-
  ignore
Review Your Changes


• Examine the detail of changes with svn diff
• --diff-cmd
Fix Your Mistakes


• Undoing your work with svn revert
• Can undo any scheduled operation
Resolve Any Conflicts
Resolve Any Conflicts


• View differences interactively
• Resolving conflict differences interactively
Resolve Any Conflicts

• Postponing conflict resolution
• file.mine file.rOLDREV file.rNEWREV
Resolve Any Conflicts
• Resolve conflicts with svn resolve
• Removes three temporary files
• Accepts the version of the file that you
  specified with the --accept option
• No longer considers the file to be in a state
  of conflict
Commit Your Changes

• Commit changes with svn commit
• --message(-m) --file(-F)
• SVN_EDITOR
Examining History

• svn log
• svn diff
• svn cat
• svn list
• svn update --revision (-r)
SVN Changing Steps

• Logs intentions in a private “to-do list”
• Performs those action to affect the desired
  change, holding a lock on the relevant part
  of the working copy
• Releases its lock and cleans up its private
  to-do list.
Clean Up

• Recover from interruption with svn cleanup
• Searches working copy
• Runs any leftover to-do items
• Removing working copy locks as it
  completes
Localization
• Notices the value of LC_MESSAGES
  variable and attempts to print messages in
  the specified language
• Locale is honored involves how svn
  interprets your input
• The repository stores all paths, filenames,
  and log messages in Unicode, encoded as
  UTF-8
Localization
• Notices the value of LC_MESSAGES
  variable and attempts to print messages in
  the specified language
• Locale is honored involves how svn
  interprets your input
• The repository stores all paths, filenames,
  and log messages in Unicode, encoded as
  UTF-8
  svn: Can’t convert string from native encoding to ‘UTF-8’:
  svn: Can’t convert string from ‘UTF-8’ to native encoding:
Advanced Topics
Revision Tricks
• Revision Keywords
 - HEAD
 - BASE
 - COMMITTED
 - PREV
• Revision Dates (-r {2011-09-30})
Peg Revisions
Complexity
Complexity
1




    dream.c
Complexity
1             2




    dream.c       dream.c
Complexity
   1                2             3




          dream.c       dream.c        dream.c

$svn log dream.c # what do you mean?
Peg and Operative

• Peg revisions
• Operative revisions
 $svn command -r OPERATIVE-REV item@PEG-REV
Peg Revisions

• A path and a peg revision can identify to a
  specific line of history
• Peg revisions are specified using at syntax
• Default peg revision is HEAD
Operative Revisions


• Specified by --revision (-r) option
• Subversion performs the requested
  operation using the operative revision
Properties
• Versioned metadata on versioned files and
  directories
• Property names contain only ASCII
  characters
• Property values can be whatever you want
• Revision Properties
Commands

• svn proplist
• svn propset
• svn propedit
• svn propget
• svn propdel
Automatic Setting
• Subversion tries to setting some common
  file properties automatically when adding
  and importing files
• Subversion tries to determine the file’s
  MIME type
• Provides flexible feature to create mappings
  of filename patterns to properties
Reserved Properties

• svn:mime-type
• svn:executable
• svn:eol-style
• svn:ignore
Sparse Directory
• By default, operations on directories act in
  a recursive manner
• This feature allows you to easily check out
  a working copy more shallowly than full
  recursion
• Free to bring in previously ignored files and
  subdirectories at a later time
Sparse Directory
• Using --depth option
 - --depth empty
 - --depth files
 - --depth immediates
 - --depth infinity
Sparse Directory
• Using --depth option
 - --depth empty
 - --depth files
 - --depth immediates
 - --depth infinity
$ svn checkout http://.../comm_proj/ --depth empty
$ svn update --set-depth infinity export_include
$ svn update --set-depth infinity export_lib_suse32
Locking

• Copy-modify-merge models lives and dies
   on its data merging algorithm
• Creating lock with svn lock
• Lock token and Lock owner
• svn:needs-lock as lock communication
$svn info https://url-to-target | grep Lock
Breaking and Stealing

• Breaking Locks
 - svn unlock --force
• Stealing Locks
 - svn lock --force
• svn status -u
Changelists

• Working at multiple changes
• Best to committed as several small logical
  units
• Need to keep logical changes organized
Changelists

• Allows you to create changelists by applying
  labels to files you want to be associated
  with the change list
• Allow you to limit the scope of the files on
  which its subcommands operate to only
  those bearing a particular label
Changelists

• Allows you to create changelists by applying
   labels to files you want to be associated
   with the change list
• Allow you to limit the scope of the files on
   which its subcommands operate to only
   those bearing a particular label
$ svn changelist ui-fixes dream.c
$ svn commit --changelist ui-fixes
Changelist
Branching and Merging
Repository Layout
Repository Layout




trunk   branches   tags
What’s a Branch
• A line of development that exists
  independently of another line
• Shares a common history if look far enough
  back in time
• Always begins life as a copy of something,
  and moves on from there, generating its
  own history
Creating a Branch
Creating a Branch
$ svn copy http://svn.example.com/repo/trunk 
       http://svn.example.com/repo/branches/my-branch 
       -m “Creating a private branch”

# Choice 1: check out new branch
$ svn checkout 
              http://svn.example.com/repo/branches/my-branch 
              my-branch

# Choice 2: switch to new branch in trunk working-copy
$ svn switch http://svn.example.com/repo/branches/my-branch
Creating a Branch
• Subversion has no internal concept of a
  branch
• Subversion’s branches exist as normal
  filesystem directories in the repository
• The only reason a copied directory is a
  “branch” is because humans have decided
  to treat it that way
Keeping Branch in Snyc
 • It’s very easy to drift too far apart.
 • May be near-impossible to merge back into
     the trunk without a huge number of
     conflicts.
 • Frequently keeping your branch in sync
     with the main line helps prevent “surprise”
     conflicts
$ cd my-branch
$ svn merge ^/trunk/
Reintegrating a Branch

 • Bring branch in sync with trunk first
 • Make sure trunk working copy do not have
     any local edits or be at mixed-revisions
 • Use svn merge with --reintegrate
$ cd trunk
$ svn merge --reintegrate ^/branches/my-branch
$ svn delete ^/branches/my-branch
Mergeinfo and Previews

• Use svn mergeinfo to see changesets has
  absorbed and eligible to receive
• Using svn merge --dry-run option to get a
  more precise preview
• Cherry Peeking
Undoing Change

 • Roll back a change that has already been
     committed
 • You can use svn merge to “undo” the
     change in your working copy, then commit
 • Specify a reverse difference
$ svn merge -c -303 ^/trunk
$ svn diff
$ svn commit -m “Undoing change committed in r303”
Resurrect Deleted Item

• Information is never lost in VCS
• Delete a file just means it gone from the
  HEAD revision, still exists in earlier
  revisions
Resurrect Deleted Item

 • Define exactly which item you’re trying to
     resurrect (By path and peg revision)
 • Two choices to resurrect
  - Use svn merge to apply “in reverse”
  - Use svn copy command
$ svn copy ^/trunk/dream.c@303 ./dream.c
$ svn commit -m “Resurrected dream.c from r303”
Tags

 • A “snapshot” of a project in time
 • Nobody commits to it
 • svn copy comes to the rescue
$ svn copy http://svn.example.com/repos/trunk 
       http://svn.example.com/repos/tags/release-1.0
$ svn copy working-copy 
       http://svn.example.com/repos/tags/release-1.0
Branching Patterns


• Release Branches
• Feature Branches
Feature Branching
Feature Branching
This could be heaven
Or this could be hell
Branches and tags are cheap
Appendix:
Bubble-Up Method
Modify a File
          1                     2   3   ...



      A       B



...               code



                     app


                         main
Modify a File
          1                     2     3    ...



      A       B



...               code



                     app


                         main       main
Modify a File
          1                     2         3   ...



      A       B



...               code



                     app            app


                         main         main
Modify a File
          1                     2         3   ...



      A       B



...               code



                     app            app


                         main         main
Modify a File
          1                     2                3   ...



      A       B



...               code              code



                     app                   app


                         main                main
Modify a File
          1                     2                3   ...



      A       B



...               code              code



                     app                   app


                         main                main
Modify a File
          1                     2                    3   ...



      A       B            A        B



...               code                  code



                     app                       app


                         main                    main
Modify a File
          1                     2                    3   ...



      A       B            A        B



...               code                  code



                     app                       app


                         main                    main
Modify a File
          1                     2                    3   ...



      A       B            A        B



...               code                  code



                     app                       app


                         main                    main
Modify a File
          1                     2                    3   ...



      A       B            A        B



...               code                  code



                     app                       app


                         main                    main
Move a File
          2                     3   4   ...



      A       B



...               code



                     app


                         main
Move a File
          2                     3         4   ...



      A       B



...               code



                     app            svr


                         main
Move a File
          2                     3         4   ...



      A       B



...               code



                     app            svr


                         main
Move a File
          2                     3                4   ...



      A       B



...               code              code



                     app                   svr


                         main
Move a File
          2                     3                4   ...



      A       B



...               code              code



                     app                   svr


                         main
Move a File
          2                     3                    4   ...



      A       B            A        B



...               code                  code



                     app                       svr


                         main
Move a File
          2                     3                    4   ...



      A       B            A        B



...               code                  code



                     app                       svr


                         main
Move a File
          2                     3                    4   ...



      A       B            A        B



...               code                  code



                     app                       svr


                         main
Move a File
          2                     3                    4   ...



      A       B            A        B



...               code                  code



                     app                       svr


                         main
Branches and Tags
          3                     4   5   ...



      A       B



...               code



                     app


                         main
Branches and Tags
          3                     4           5   ...



      A       B                     A   B   T



...               code



                     app


                         main
Branches and Tags
          3                     4           5   ...



      A       B                     A   B   T



...               code



                     app


                         main
Branches and Tags
          3                     4           5   ...



      A       B                     A   B   T



...               code



                     app


                         main
Branches and Tags
          3                     4           5      ...



      A       B                     A   B   T



...               code



                     app                    Cheap Copy
                         main
References

• Version Control with Subversion
• Feature Branch
• Subversion Design Document
Thank You

More Related Content

What's hot

Storage virtualization citrix blr wide tech talk
Storage virtualization citrix blr wide tech talkStorage virtualization citrix blr wide tech talk
Storage virtualization citrix blr wide tech talkSisimon Soman
 
Chef, Vagrant and Friends
Chef, Vagrant and FriendsChef, Vagrant and Friends
Chef, Vagrant and FriendsBen McRae
 
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovations
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovationsZarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovations
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovationsZarafa
 
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 presentationcohlmann
 
Introduction to Subversion and Google Project Hosting
Introduction to Subversion and Google Project HostingIntroduction to Subversion and Google Project Hosting
Introduction to Subversion and Google Project HostingPhilip Johnson
 
January OpenNTF Webinar - Backup your Domino Server - New Options in V12
January OpenNTF Webinar - Backup your Domino Server - New Options in V12January OpenNTF Webinar - Backup your Domino Server - New Options in V12
January OpenNTF Webinar - Backup your Domino Server - New Options in V12Howard Greenberg
 
Totalsvn Usage And Administration By Gopi
Totalsvn Usage And Administration By GopiTotalsvn Usage And Administration By Gopi
Totalsvn Usage And Administration By Gopigopinathkarangula
 
Rails - getting started
Rails - getting startedRails - getting started
Rails - getting startedTrue North
 
Scale your Alfresco Solutions
Scale your Alfresco Solutions Scale your Alfresco Solutions
Scale your Alfresco Solutions Alfresco Software
 
PHP in the Cloud
PHP in the CloudPHP in the Cloud
PHP in the CloudAcquia
 
The Alfresco ECM 1 Billion Document Benchmark on AWS and Aurora - Benchmark ...
The Alfresco ECM 1 Billion Document Benchmark on AWS and Aurora  - Benchmark ...The Alfresco ECM 1 Billion Document Benchmark on AWS and Aurora  - Benchmark ...
The Alfresco ECM 1 Billion Document Benchmark on AWS and Aurora - Benchmark ...Symphony Software Foundation
 
Moving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco RepositoryMoving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco RepositoryJeff Potts
 
Altoros Cloud Foundry Training: hands-on workshop for DevOps, Architects and ...
Altoros Cloud Foundry Training: hands-on workshop for DevOps, Architects and ...Altoros Cloud Foundry Training: hands-on workshop for DevOps, Architects and ...
Altoros Cloud Foundry Training: hands-on workshop for DevOps, Architects and ...Manuel Garcia
 
Event Driven Architectures with Camel
Event Driven Architectures with CamelEvent Driven Architectures with Camel
Event Driven Architectures with Camelgnanagurus
 
#sitNL presentation sap teched berlin v3
#sitNL presentation sap teched berlin v3#sitNL presentation sap teched berlin v3
#sitNL presentation sap teched berlin v3Twan van den Broek
 
201511 - Alfresco Day - Platform Update and Roadmap - Gabriele Columbro - Bo...
201511 -  Alfresco Day - Platform Update and Roadmap - Gabriele Columbro - Bo...201511 -  Alfresco Day - Platform Update and Roadmap - Gabriele Columbro - Bo...
201511 - Alfresco Day - Platform Update and Roadmap - Gabriele Columbro - Bo...Symphony Software Foundation
 

What's hot (20)

Storage virtualization citrix blr wide tech talk
Storage virtualization citrix blr wide tech talkStorage virtualization citrix blr wide tech talk
Storage virtualization citrix blr wide tech talk
 
Chef, Vagrant and Friends
Chef, Vagrant and FriendsChef, Vagrant and Friends
Chef, Vagrant and Friends
 
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovations
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovationsZarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovations
Zarafa SummerCamp 2012 - Keynote Steve Hardy - 3 Cool innovations
 
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
 
Introduction to Subversion and Google Project Hosting
Introduction to Subversion and Google Project HostingIntroduction to Subversion and Google Project Hosting
Introduction to Subversion and Google Project Hosting
 
January OpenNTF Webinar - Backup your Domino Server - New Options in V12
January OpenNTF Webinar - Backup your Domino Server - New Options in V12January OpenNTF Webinar - Backup your Domino Server - New Options in V12
January OpenNTF Webinar - Backup your Domino Server - New Options in V12
 
Totalsvn Usage And Administration By Gopi
Totalsvn Usage And Administration By GopiTotalsvn Usage And Administration By Gopi
Totalsvn Usage And Administration By Gopi
 
Rails - getting started
Rails - getting startedRails - getting started
Rails - getting started
 
High Availability Solutions in SQL 2012
High Availability Solutions in SQL 2012High Availability Solutions in SQL 2012
High Availability Solutions in SQL 2012
 
Scale your Alfresco Solutions
Scale your Alfresco Solutions Scale your Alfresco Solutions
Scale your Alfresco Solutions
 
eCAP Developer Walkthru
eCAP Developer WalkthrueCAP Developer Walkthru
eCAP Developer Walkthru
 
PHP in the Cloud
PHP in the CloudPHP in the Cloud
PHP in the Cloud
 
201408 - Alfresco Tech Talk Live - Maven SDK 2.0
201408  - Alfresco Tech Talk Live - Maven SDK 2.0201408  - Alfresco Tech Talk Live - Maven SDK 2.0
201408 - Alfresco Tech Talk Live - Maven SDK 2.0
 
The Alfresco ECM 1 Billion Document Benchmark on AWS and Aurora - Benchmark ...
The Alfresco ECM 1 Billion Document Benchmark on AWS and Aurora  - Benchmark ...The Alfresco ECM 1 Billion Document Benchmark on AWS and Aurora  - Benchmark ...
The Alfresco ECM 1 Billion Document Benchmark on AWS and Aurora - Benchmark ...
 
Moving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco RepositoryMoving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco Repository
 
Altoros Cloud Foundry Training: hands-on workshop for DevOps, Architects and ...
Altoros Cloud Foundry Training: hands-on workshop for DevOps, Architects and ...Altoros Cloud Foundry Training: hands-on workshop for DevOps, Architects and ...
Altoros Cloud Foundry Training: hands-on workshop for DevOps, Architects and ...
 
Event Driven Architectures with Camel
Event Driven Architectures with CamelEvent Driven Architectures with Camel
Event Driven Architectures with Camel
 
Xen Hypervisor Update 2011
Xen Hypervisor Update 2011Xen Hypervisor Update 2011
Xen Hypervisor Update 2011
 
#sitNL presentation sap teched berlin v3
#sitNL presentation sap teched berlin v3#sitNL presentation sap teched berlin v3
#sitNL presentation sap teched berlin v3
 
201511 - Alfresco Day - Platform Update and Roadmap - Gabriele Columbro - Bo...
201511 -  Alfresco Day - Platform Update and Roadmap - Gabriele Columbro - Bo...201511 -  Alfresco Day - Platform Update and Roadmap - Gabriele Columbro - Bo...
201511 - Alfresco Day - Platform Update and Roadmap - Gabriele Columbro - Bo...
 

Similar to Version Control with Subversion

Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With SubversionSamnang Chhun
 
Source version control using subversion
Source version control using subversionSource version control using subversion
Source version control using subversionMangesh Bhujbal
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best PracticesMaidul Islam
 
Subversion Overview
Subversion OverviewSubversion Overview
Subversion Overviewpolarion
 
Git vs Subversion: ¿Cuando elegir uno u otro?
Git vs Subversion: ¿Cuando elegir uno u otro?Git vs Subversion: ¿Cuando elegir uno u otro?
Git vs Subversion: ¿Cuando elegir uno u otro?Paradigma Digital
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svnAnkur Goyal
 
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 forgeJasmine Conseil
 
Burlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion PresentationBurlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion PresentationBradley Holt
 
Oak, the architecture of Apache Jackrabbit 3
Oak, the architecture of Apache Jackrabbit 3Oak, the architecture of Apache Jackrabbit 3
Oak, the architecture of Apache Jackrabbit 3Jukka Zitting
 
Version Control and Continuous Integration
Version Control and Continuous IntegrationVersion Control and Continuous Integration
Version Control and Continuous IntegrationGeff Henderson Chang
 
Zero downtime deploys for Rails apps
Zero downtime deploys for Rails appsZero downtime deploys for Rails apps
Zero downtime deploys for Rails appspedrobelo
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topicGourav Varma
 
Subversion: A Getting Started Presentation
Subversion: A Getting Started PresentationSubversion: A Getting Started Presentation
Subversion: A Getting Started PresentationNap Ramirez
 

Similar to Version Control with Subversion (20)

Version Control With Subversion
Version Control With SubversionVersion Control With Subversion
Version Control With Subversion
 
SVN
SVNSVN
SVN
 
Source version control using subversion
Source version control using subversionSource version control using subversion
Source version control using subversion
 
Versioning for Developers
Versioning for DevelopersVersioning for Developers
Versioning for Developers
 
Subversion last minute survival crash course
Subversion  last minute survival crash courseSubversion  last minute survival crash course
Subversion last minute survival crash course
 
Svn workflow
Svn workflowSvn workflow
Svn workflow
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best Practices
 
SVN Information
SVN Information  SVN Information
SVN Information
 
Subversion Overview
Subversion OverviewSubversion Overview
Subversion Overview
 
Subversion (SVN)
Subversion (SVN)Subversion (SVN)
Subversion (SVN)
 
Git vs Subversion: ¿Cuando elegir uno u otro?
Git vs Subversion: ¿Cuando elegir uno u otro?Git vs Subversion: ¿Cuando elegir uno u otro?
Git vs Subversion: ¿Cuando elegir uno u otro?
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svn
 
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
 
Serverless design with Fn project
Serverless design with Fn projectServerless design with Fn project
Serverless design with Fn project
 
Burlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion PresentationBurlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion Presentation
 
Oak, the architecture of Apache Jackrabbit 3
Oak, the architecture of Apache Jackrabbit 3Oak, the architecture of Apache Jackrabbit 3
Oak, the architecture of Apache Jackrabbit 3
 
Version Control and Continuous Integration
Version Control and Continuous IntegrationVersion Control and Continuous Integration
Version Control and Continuous Integration
 
Zero downtime deploys for Rails apps
Zero downtime deploys for Rails appsZero downtime deploys for Rails apps
Zero downtime deploys for Rails apps
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
Subversion: A Getting Started Presentation
Subversion: A Getting Started PresentationSubversion: A Getting Started Presentation
Subversion: A Getting Started Presentation
 

Recently uploaded

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 

Recently uploaded (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 

Version Control with Subversion

  • 1. Version Control with Subversion Kent Wang Sep 27, 2011
  • 2. Sometimes there’s a single right way to do things; Sometimes there are many
  • 3. Agenda • Overview • Fundamental Concepts • Basic Usage • Advanced Topics • Branching and Merging • Appendix: Bubble-Up Method
  • 5. What is Subversion? • Version control system (VCS) • Centralized • Free & Open Source (Apache License)
  • 7. History • Early 2000, began in CollabNet, Inc. • May 2000, detailed design began • Aug 31, 2001 , “Self-hosting” • Early 2010, integrated into ASF
  • 9. command-line client app GUI client apps client interface Client Library Working Copy Management Library Repository Access DAV SVN Local Apache mode_dav svnserve mod_dav_svn repository interface Subversion Repository Berkeley DB FSFS
  • 11. Version Control Basics Repository • The Repository • The Working Copy Client Client Client
  • 12. Version Control Basics • Versioning Models - The problem of file sharing - The lock-modify-unlock solution - The copy-modify-merge solution
  • 13. The problem of sharing
  • 17. Subversion Way • Subversion Repositories • Addressing the Repository • Revisions
  • 19. Revisions 0 1 2 3
  • 20. Subversion Way • Working copies - How the working copy works - Disposing of a Working Copy - Administrative directory - Mixed-revision
  • 21. Subversion Way • Working copies - How the working copy works at e! - Disposing of a Working Copy re sep ar - Administrative directory it sa m c om - Mixed-revision te sa nd p da U
  • 23. Help! • svn help • svn help subcommand
  • 24. Importing • Working copy not required • Files are immediately committed to the repository • Original local directory not converted into a working copy $ svn import unversioned-directory http://svn.example.com/repos/trunk/magic
  • 25. Create a working copy • Create a working copy on local machine • Every directory in a working copy contains an .svn subdirectory $ svn checkout http://svn.example.com/repos/trunk/magic working-copy
  • 26. Basic Work Cycle • Update your working copy • Make your changes • Review your changes • Fix your mistakes • Resolve any conflicts • Publish (commit) your changes
  • 27. Update working copy • Update to specified revision with -r • Commit new changes to out-of-date files and directories is not allowed by svn $ cd working-copy $ svn update
  • 28. Make your change • File changes - Make changes using what ever tools - Svn automatically detects file changes • Tree changes - Changes to a directory’s structure - Use svn operations to “schedule”
  • 29. Review Your Changes • Subcommand: status diff revert • Without Network
  • 30. Review Your Changes • Subcommand: status diff revert • Without Network • Subversion keeping private caches of pristine versions in .svn/text-base/
  • 31. Review Your Changes • Overview of your changes with svn status • --show-updates(-u) --verbose(-v) --no- ignore
  • 32. Review Your Changes • Examine the detail of changes with svn diff • --diff-cmd
  • 33. Fix Your Mistakes • Undoing your work with svn revert • Can undo any scheduled operation
  • 35. Resolve Any Conflicts • View differences interactively • Resolving conflict differences interactively
  • 36. Resolve Any Conflicts • Postponing conflict resolution • file.mine file.rOLDREV file.rNEWREV
  • 37. Resolve Any Conflicts • Resolve conflicts with svn resolve • Removes three temporary files • Accepts the version of the file that you specified with the --accept option • No longer considers the file to be in a state of conflict
  • 38. Commit Your Changes • Commit changes with svn commit • --message(-m) --file(-F) • SVN_EDITOR
  • 39. Examining History • svn log • svn diff • svn cat • svn list • svn update --revision (-r)
  • 40. SVN Changing Steps • Logs intentions in a private “to-do list” • Performs those action to affect the desired change, holding a lock on the relevant part of the working copy • Releases its lock and cleans up its private to-do list.
  • 41. Clean Up • Recover from interruption with svn cleanup • Searches working copy • Runs any leftover to-do items • Removing working copy locks as it completes
  • 42. Localization • Notices the value of LC_MESSAGES variable and attempts to print messages in the specified language • Locale is honored involves how svn interprets your input • The repository stores all paths, filenames, and log messages in Unicode, encoded as UTF-8
  • 43. Localization • Notices the value of LC_MESSAGES variable and attempts to print messages in the specified language • Locale is honored involves how svn interprets your input • The repository stores all paths, filenames, and log messages in Unicode, encoded as UTF-8 svn: Can’t convert string from native encoding to ‘UTF-8’: svn: Can’t convert string from ‘UTF-8’ to native encoding:
  • 44.
  • 46. Revision Tricks • Revision Keywords - HEAD - BASE - COMMITTED - PREV • Revision Dates (-r {2011-09-30})
  • 49. Complexity 1 dream.c
  • 50. Complexity 1 2 dream.c dream.c
  • 51. Complexity 1 2 3 dream.c dream.c dream.c $svn log dream.c # what do you mean?
  • 52. Peg and Operative • Peg revisions • Operative revisions $svn command -r OPERATIVE-REV item@PEG-REV
  • 53. Peg Revisions • A path and a peg revision can identify to a specific line of history • Peg revisions are specified using at syntax • Default peg revision is HEAD
  • 54. Operative Revisions • Specified by --revision (-r) option • Subversion performs the requested operation using the operative revision
  • 55. Properties • Versioned metadata on versioned files and directories • Property names contain only ASCII characters • Property values can be whatever you want • Revision Properties
  • 56. Commands • svn proplist • svn propset • svn propedit • svn propget • svn propdel
  • 57. Automatic Setting • Subversion tries to setting some common file properties automatically when adding and importing files • Subversion tries to determine the file’s MIME type • Provides flexible feature to create mappings of filename patterns to properties
  • 58. Reserved Properties • svn:mime-type • svn:executable • svn:eol-style • svn:ignore
  • 59. Sparse Directory • By default, operations on directories act in a recursive manner • This feature allows you to easily check out a working copy more shallowly than full recursion • Free to bring in previously ignored files and subdirectories at a later time
  • 60. Sparse Directory • Using --depth option - --depth empty - --depth files - --depth immediates - --depth infinity
  • 61. Sparse Directory • Using --depth option - --depth empty - --depth files - --depth immediates - --depth infinity $ svn checkout http://.../comm_proj/ --depth empty $ svn update --set-depth infinity export_include $ svn update --set-depth infinity export_lib_suse32
  • 62. Locking • Copy-modify-merge models lives and dies on its data merging algorithm • Creating lock with svn lock • Lock token and Lock owner • svn:needs-lock as lock communication $svn info https://url-to-target | grep Lock
  • 63. Breaking and Stealing • Breaking Locks - svn unlock --force • Stealing Locks - svn lock --force • svn status -u
  • 64. Changelists • Working at multiple changes • Best to committed as several small logical units • Need to keep logical changes organized
  • 65. Changelists • Allows you to create changelists by applying labels to files you want to be associated with the change list • Allow you to limit the scope of the files on which its subcommands operate to only those bearing a particular label
  • 66. Changelists • Allows you to create changelists by applying labels to files you want to be associated with the change list • Allow you to limit the scope of the files on which its subcommands operate to only those bearing a particular label $ svn changelist ui-fixes dream.c $ svn commit --changelist ui-fixes
  • 68.
  • 71. Repository Layout trunk branches tags
  • 72. What’s a Branch • A line of development that exists independently of another line • Shares a common history if look far enough back in time • Always begins life as a copy of something, and moves on from there, generating its own history
  • 74. Creating a Branch $ svn copy http://svn.example.com/repo/trunk http://svn.example.com/repo/branches/my-branch -m “Creating a private branch” # Choice 1: check out new branch $ svn checkout http://svn.example.com/repo/branches/my-branch my-branch # Choice 2: switch to new branch in trunk working-copy $ svn switch http://svn.example.com/repo/branches/my-branch
  • 75. Creating a Branch • Subversion has no internal concept of a branch • Subversion’s branches exist as normal filesystem directories in the repository • The only reason a copied directory is a “branch” is because humans have decided to treat it that way
  • 76. Keeping Branch in Snyc • It’s very easy to drift too far apart. • May be near-impossible to merge back into the trunk without a huge number of conflicts. • Frequently keeping your branch in sync with the main line helps prevent “surprise” conflicts $ cd my-branch $ svn merge ^/trunk/
  • 77. Reintegrating a Branch • Bring branch in sync with trunk first • Make sure trunk working copy do not have any local edits or be at mixed-revisions • Use svn merge with --reintegrate $ cd trunk $ svn merge --reintegrate ^/branches/my-branch $ svn delete ^/branches/my-branch
  • 78. Mergeinfo and Previews • Use svn mergeinfo to see changesets has absorbed and eligible to receive • Using svn merge --dry-run option to get a more precise preview • Cherry Peeking
  • 79. Undoing Change • Roll back a change that has already been committed • You can use svn merge to “undo” the change in your working copy, then commit • Specify a reverse difference $ svn merge -c -303 ^/trunk $ svn diff $ svn commit -m “Undoing change committed in r303”
  • 80. Resurrect Deleted Item • Information is never lost in VCS • Delete a file just means it gone from the HEAD revision, still exists in earlier revisions
  • 81. Resurrect Deleted Item • Define exactly which item you’re trying to resurrect (By path and peg revision) • Two choices to resurrect - Use svn merge to apply “in reverse” - Use svn copy command $ svn copy ^/trunk/dream.c@303 ./dream.c $ svn commit -m “Resurrected dream.c from r303”
  • 82. Tags • A “snapshot” of a project in time • Nobody commits to it • svn copy comes to the rescue $ svn copy http://svn.example.com/repos/trunk http://svn.example.com/repos/tags/release-1.0 $ svn copy working-copy http://svn.example.com/repos/tags/release-1.0
  • 83. Branching Patterns • Release Branches • Feature Branches
  • 86. This could be heaven
  • 87. Or this could be hell
  • 88. Branches and tags are cheap
  • 89.
  • 91. Modify a File 1 2 3 ... A B ... code app main
  • 92. Modify a File 1 2 3 ... A B ... code app main main
  • 93. Modify a File 1 2 3 ... A B ... code app app main main
  • 94. Modify a File 1 2 3 ... A B ... code app app main main
  • 95. Modify a File 1 2 3 ... A B ... code code app app main main
  • 96. Modify a File 1 2 3 ... A B ... code code app app main main
  • 97. Modify a File 1 2 3 ... A B A B ... code code app app main main
  • 98. Modify a File 1 2 3 ... A B A B ... code code app app main main
  • 99. Modify a File 1 2 3 ... A B A B ... code code app app main main
  • 100. Modify a File 1 2 3 ... A B A B ... code code app app main main
  • 101. Move a File 2 3 4 ... A B ... code app main
  • 102. Move a File 2 3 4 ... A B ... code app svr main
  • 103. Move a File 2 3 4 ... A B ... code app svr main
  • 104. Move a File 2 3 4 ... A B ... code code app svr main
  • 105. Move a File 2 3 4 ... A B ... code code app svr main
  • 106. Move a File 2 3 4 ... A B A B ... code code app svr main
  • 107. Move a File 2 3 4 ... A B A B ... code code app svr main
  • 108. Move a File 2 3 4 ... A B A B ... code code app svr main
  • 109. Move a File 2 3 4 ... A B A B ... code code app svr main
  • 110. Branches and Tags 3 4 5 ... A B ... code app main
  • 111. Branches and Tags 3 4 5 ... A B A B T ... code app main
  • 112. Branches and Tags 3 4 5 ... A B A B T ... code app main
  • 113. Branches and Tags 3 4 5 ... A B A B T ... code app main
  • 114. Branches and Tags 3 4 5 ... A B A B T ... code app Cheap Copy main
  • 115. References • Version Control with Subversion • Feature Branch • Subversion Design Document

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. 严格来讲不算scm\n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. Unlike most version control systems, Subversion's revision numbers apply to entire trees, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change. Another way to think about it is that revision N represents the state of the repository filesystem after the Nth commit.\n\n
  18. Unlike most version control systems, Subversion's revision numbers apply to entire trees, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change. Another way to think about it is that revision N represents the state of the repository filesystem after the Nth commit.\n\n
  19. Unlike most version control systems, Subversion's revision numbers apply to entire trees, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change. Another way to think about it is that revision N represents the state of the repository filesystem after the Nth commit.\n\n
  20. Unlike most version control systems, Subversion's revision numbers apply to entire trees, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change. Another way to think about it is that revision N represents the state of the repository filesystem after the Nth commit.\n\n
  21. Unlike most version control systems, Subversion's revision numbers apply to entire trees, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change. Another way to think about it is that revision N represents the state of the repository filesystem after the Nth commit.\n\n
  22. Unlike most version control systems, Subversion's revision numbers apply to entire trees, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change. Another way to think about it is that revision N represents the state of the repository filesystem after the Nth commit.\n\n
  23. Unlike most version control systems, Subversion's revision numbers apply to entire trees, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change. Another way to think about it is that revision N represents the state of the repository filesystem after the Nth commit.\n\n
  24. Unlike most version control systems, Subversion's revision numbers apply to entire trees, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change. Another way to think about it is that revision N represents the state of the repository filesystem after the Nth commit.\n\n
  25. Unlike most version control systems, Subversion's revision numbers apply to entire trees, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change. Another way to think about it is that revision N represents the state of the repository filesystem after the Nth commit.\n\n
  26. \nFor each file in a working directory, Subversion records (among other things) two essential pieces of information:\nWhat revision your working file is based on (this is called the file's working revision) \nA timestamp recording when the local copy was last updated by the repositor \nGiven this information, by talking to the repository, Subversion can tell which of the following four states a working file is in: Unchanged, and currentThe file is unchanged in the working directory, and no changes to that file have been committed to the repository since its working revision. An svn commit of the file will do nothing, and an svn update of the file will do nothing. Locally changed, and currentThe file has been changed in the working directory, and no changes to that file have been committed to the repository since you last updated. There are local changes that have not been committed to the repository; thus an svn commit of the file will succeed in publishing your changes, and an svn update of the file will do nothing. Unchanged, and out of dateThe file has not been changed in the working directory, but it has been changed in the repository. The file should eventually be updated in order to make it current with the latest public revision. An svn commit of the file will do nothing, and an svn up- date of the file will fold the latest changes into your working copy. Locally changed, and out of dateThe file has been changed both in the working directory and in the repository. An svn commit of the file will fail with an “out-of-date” error. The file should be updated first; an svn update command will attempt to merge the public changes with the local changes. If Subversion can't complete the merge in a plausible way automatically, it leaves it to the user to resolve the conflict. \n\nupdates and commits are separate\nMixed revisions are normal\n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. Tree changes are different, and involve changes to a directory's structure. Such changes include adding and removing files, renam- ing files or directories, and copying files or directories to new locations.\nFor tree changes, you use Subversion operations to “schedule” files and directories for removal, addition, copying, or moving. These changes may take place immediately in your working copy, but no additions or removals will happen in the repository until you commit them.\n\n
  34. Subversion does this by keeping private caches of pristine, unmodified versions of each versioned file inside its working copy administrative areas. This allows Subversion to report—and revert—local modifications to those files without network access. \nThis cache (called the text-base) also allows Subversion to send the user's local modifications during a commit to the server as a compressed delta (or “difference”) against the pristine version. \nHaving this cache is a tremendous benefit—even if you have a fast Internet connection, it's generally much faster to send only a file's changes rather than the whole file to the server.\n\n
  35. Subversion does this by keeping private caches of pristine, unmodified versions of each versioned file inside its working copy administrative areas. This allows Subversion to report—and revert—local modifications to those files without network access. \nThis cache (called the text-base) also allows Subversion to send the user's local modifications during a commit to the server as a compressed delta (or “difference”) against the pristine version. \nHaving this cache is a tremendous benefit—even if you have a fast Internet connection, it's generally much faster to send only a file's changes rather than the whole file to the server.\n\n
  36. Subversion does this by keeping private caches of pristine, unmodified versions of each versioned file inside its working copy administrative areas. This allows Subversion to report—and revert—local modifications to those files without network access. \nThis cache (called the text-base) also allows Subversion to send the user's local modifications during a commit to the server as a compressed delta (or “difference”) against the pristine version. \nHaving this cache is a tremendous benefit—even if you have a fast Internet connection, it's generally much faster to send only a file's changes rather than the whole file to the server.\n\n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. svn log -v\nsvn log -q\nsvn log -r 1:10\n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. svn提供了足够的灵活性,能够非常方便随意的管理文件目录\n\nSubversion's file management support is quite liberating, affording almost as much flexibility for versioned files as you'd expect when manipulating your unversioned ones. But that flexibility means that across the lifetime of your repository, a given versioned object might have many paths, and a given path might represent several entirely different versioned objects. This introduces a certain level of com- plexity to your interactions with those paths and objects.\n\n
  52. Subversion's file management support is quite liberating, affording almost as much flexibility for versioned files as you'd expect when manipulating your unversioned ones. But that flexibility means that across the lifetime of your repository, a given versioned object might have many paths, and a given path might represent several entirely different versioned objects. This introduces a certain level of com- plexity to your interactions with those paths and objects.\n\n
  53. Subversion's file management support is quite liberating, affording almost as much flexibility for versioned files as you'd expect when manipulating your unversioned ones. But that flexibility means that across the lifetime of your repository, a given versioned object might have many paths, and a given path might represent several entirely different versioned objects. This introduces a certain level of com- plexity to your interactions with those paths and objects.\n\n
  54. Subversion's file management support is quite liberating, affording almost as much flexibility for versioned files as you'd expect when manipulating your unversioned ones. But that flexibility means that across the lifetime of your repository, a given versioned object might have many paths, and a given path might represent several entirely different versioned objects. This introduces a certain level of com- plexity to your interactions with those paths and objects.\n\n
  55. Subversion's file management support is quite liberating, affording almost as much flexibility for versioned files as you'd expect when manipulating your unversioned ones. But that flexibility means that across the lifetime of your repository, a given versioned object might have many paths, and a given path might represent several entirely different versioned objects. This introduces a certain level of com- plexity to your interactions with those paths and objects.\n\n
  56. Subversion's file management support is quite liberating, affording almost as much flexibility for versioned files as you'd expect when manipulating your unversioned ones. But that flexibility means that across the lifetime of your repository, a given versioned object might have many paths, and a given path might represent several entirely different versioned objects. This introduces a certain level of com- plexity to your interactions with those paths and objects.\n\n
  57. Subversion's file management support is quite liberating, affording almost as much flexibility for versioned files as you'd expect when manipulating your unversioned ones. But that flexibility means that across the lifetime of your repository, a given versioned object might have many paths, and a given path might represent several entirely different versioned objects. This introduces a certain level of com- plexity to your interactions with those paths and objects.\n\n
  58. Subversion's file management support is quite liberating, affording almost as much flexibility for versioned files as you'd expect when manipulating your unversioned ones. But that flexibility means that across the lifetime of your repository, a given versioned object might have many paths, and a given path might represent several entirely different versioned objects. This introduces a certain level of com- plexity to your interactions with those paths and objects.\n\n
  59. Subversion's file management support is quite liberating, affording almost as much flexibility for versioned files as you'd expect when manipulating your unversioned ones. But that flexibility means that across the lifetime of your repository, a given versioned object might have many paths, and a given path might represent several entirely different versioned objects. This introduces a certain level of com- plexity to your interactions with those paths and objects.\n\n
  60. Subversion's file management support is quite liberating, affording almost as much flexibility for versioned files as you'd expect when manipulating your unversioned ones. But that flexibility means that across the lifetime of your repository, a given versioned object might have many paths, and a given path might represent several entirely different versioned objects. This introduces a certain level of com- plexity to your interactions with those paths and objects.\n\n
  61. Subversion's file management support is quite liberating, affording almost as much flexibility for versioned files as you'd expect when manipulating your unversioned ones. But that flexibility means that across the lifetime of your repository, a given versioned object might have many paths, and a given path might represent several entirely different versioned objects. This introduces a certain level of com- plexity to your interactions with those paths and objects.\n\n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. native\nThis causes the file to contain the EOL markers that are native to the operating system on which Subversion was run. In other words, if a user on a Windows machine checks out a working copy that contains a file with an svn:eol-style property set to native, that file will contain CRLF EOL markers. A Unix user checking out a working copy that contains the same file will see LF EOL markers in his copy of the file.\nNote that Subversion will actually store the file in the repository using normalized LF EOL markers regardless of the operating system. This is basically transparent to the user, though.\nCRLFThis causes the file to contain CRLF sequences for EOL markers, regardless of the operating system in use.\nLFThis causes the file to contain LF characters for EOL markers, regardless of the operating system in use.\nCRThis causes the file to contain CR characters for EOL markers, regardless of the operating system in use. This line-ending style is not very common.\nAnd it's worth noting again that, unlike the global-ignores option, the patterns found in the svn:ignore property apply only to the directory on which that property is set, and not to any of its subdirectories.\n\n
  69. For example, svn checkout creates a working copy with every file and directory in the specified area of the repository, descending recursively through the repository tree until the entire structure is copied to your local disk.\nIntroduced in subversion 1.5\n
  70. For example, svn checkout creates a working copy with every file and directory in the specified area of the repository, descending recursively through the repository tree until the entire structure is copied to your local disk.\nIntroduced in subversion 1.5\n如果只是一个参数就不值得拿出来说,特殊的地方在于,这个depth的值是会保存在working-copy中的\n1. 只checkout关心的部分\n2. subversion会记住这个depth值,后续只需直接update\n
  71. For example, suppose Harry locks an image file and then begins editing it. Meanwhile, miles away, Sally wants to do the same thing. She doesn't think to run svn status -u, so she has no idea that Harry has already locked the file. She spends hours edit- ing the file, and when she tries to commit her change, she discovers that either the file is locked or that she's out of date. Regard- less, her changes aren't mergeable with Harry's. One of these two people has to throw away his or her work, and a lot of time has been wasted.\n\n
  72. svn status -u\nB -- Broken\nT -- sTolen\n
  73. \n
  74. The --changelist option acts only as a filter for Subversion command targets, and will not add targets to an operation.\n
  75. \n
  76. \n
  77. \n
  78. This is the basic concept of a branch—namely, a line of development that exists independently of another line, yet still shares a common history if you look far enough back in time. A branch always begins life as a copy of something, and moves on from there, generating its own history\n\n
  79. the only reason a copied directory is a “branch” is because humans have decided to treat it that way\n
  80. \n
  81. Why not diff? or manual \n
  82. Notice our use of the - -reintegrate option this time around. The option is critical for reintegrating changes from a branch back into its original line of development—don't forget it! It's needed because this sort of “merge back” is a different sort of work than what you've been do- ing up until now. Previously, we had been asking svn merge to grab the “next set” of changes from one line of development (the trunk) and duplicate them to another (your branch). This is fairly straightforward, and each time Subversion knows how to pick up where it left off. \nWhen merging your branch back to the trunk, however, the underlying mathematics is quite different. Your feature branch is now a mishmash of both duplicated trunk changes and private branch changes, so there's no simple contiguous range of revisions to copy over. By specifying the --reintegrate option, you're asking Subversion to carefully replicate only those changes unique to your branch. (And in fact, it does this by comparing the latest trunk tree with the latest branch tree: the resulting difference is ex- actly your branch changes!)\n\n
  83. \n
  84. \n
  85. \n
  86. \n
  87. Just as with branches, the only reason a copied directory is a “tag” is because humans have decided to treat it that way\n
  88. Release Branches\nMost software has a typical life cycle: code, test, release, repeat. There are two problems with this process. First, developers need to keep writing new features while quality assurance teams take time to test supposedly stable versions of the software. New work cannot halt while the software is tested. Second, the team almost always needs to support older, released versions of software; if a bug is discovered in the latest code, it most likely exists in released versions as well, and customers will want to get that bug fix without having to wait for a major new release.\n\nFeature Branches\nIt's a temporary branch created to work on a complex change without interfering with the stability of /trunk. Unlike release branches (which may need to be supported forever), feature branches are born, used for a while, merged back to the trunk, and then ultimately deleted. They have a finite span of usefulness.\nFinally, there's the issue of how to best keep a feature branch in “sync” with the trunk as work progresses. As we mentioned earlier, there's a great risk to working on a branch for weeks or months; trunk changes may continue to pour in, to the point where the two lines of development differ so greatly that it may become a nightmare trying to merge the branch back to the trunk.\nThis situation is best avoided by regularly merging trunk changes to the branch. Make up a policy: once a week, merge the last week's worth of trunk changes to the branch.\n
  89. \n
  90. \n
  91. \n
  92. 创建了太多branch会不会对svn造成性能问题及存储空间浪费?repositroy会不会急剧增长?\n\nIt doesn't matter how large the directory is—it takes a very tiny, constant amount of time and space to make a copy of it. In fact, this feature is the basis of how commits work in Subversion: each revision is a “cheap copy” of the previous revision, with a few items lazily changed within.\nSo don't be afraid to use them when needed!\n
  93. \n
  94. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  95. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  96. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  97. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  98. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  99. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  100. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  101. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  102. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  103. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  104. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  105. Easy reads. If a filesystem reader wants to locate revision X of file foo.c, it need only traverse the repository's history, locate revision X's root node, then walk down the tree to foo.c.\nWriters don't interfere with readers. Writers can continue to create new nodes, bubbling their way up to the top, and concurrent readers cannot see the work in progress. The new tree only becomes visible to readers after the writer makes its final “link” to the repository's history.\nFile structure is versioned. Unlike CVS, the very structure of each tree is being saved from revision to revision. File and directory renames, additions, and deletions are part of the repository's history.\n
  106. \n
  107. \n
  108. \n
  109. \n
  110. \n
  111. \n
  112. \n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. \n
  123. \n
  124. \n
  125. \n
  126. \n
  127. \n