SVN Basic Tutorial 12040823s2813 Phpapp01
SVN Basic Tutorial 12040823s2813 Phpapp01
SVN Basic Tutorial 12040823s2813 Phpapp01
Avoiding headaches
Direct deploy
Develop
er 1
Stagi
ng
Live
Develop
er 2
Stagi
ng
Live
Designe
r1
Stagi
ng
Live
Designe
r2
Stagi
ng
Live
Stagi
ng
Live
Develop
er 2
Stagi
ng
Live
Designe
r1
Stagi
ng
Live
Designe
r2
Stagi
ng
Live
SVN
Subversion (SVN) is a SCM
(Software Configuration
Management) implementation
It allows to track changes in files
and directories
It allows concurrent development
on the same files
It is centralized (one server)
SVN Interaction
Designer
1
Designer
2
Develop
er 2
Develop
er 1
Staging
Server
Issue
Tracker
SVN
Serv
er
Productio
n Server
Send work to
SVN server
Develop/Desi
gn
Test
svn
commit
edit
files
Test
How it works
Develope
r1
Develope
r2
We can then
$ svn commit -m "Merged changes of
marcos commit"
Merging workflow
svn commit
Developer
verifies
merge
svn tries to
merge
Cant
commit
(outdated
working
copy)
svn update
SVN
couldnt
merge
????????
svn tries to
merge
Cant
commit
(outdated
working
copy)
svn update
SVN Conflicts
SVN conflicts happen when two developers
act on a same file in the same line:
Develope
r1
Develope
r2
echo hello
everybody;
echo
$_GET[username];
goodbye
echo
everybody;
echo
$_GET[username];
RED = changed by developer
SVN Conflicts
SVN Conflicts
index.php is a merged view of the conflict:
SVN Conflicts
We can edit the files until all conflicts
are solved, then tell SVN it should
accept our new working copy:
SVN Conflicts
svn commit
Mark
conflicts
as
resolved
Cant
commit
(outdated
working
copy)
Manuall
y edit
conflicts
svn update
SVN
couldnt
merge
svn tries to
merge
Parallel development
SVN branching
Main project
The main project
and its features
This is actually
how
git-flow by
nvie.com handles
development, but
SVN could also
use it!
What is a branch?
In SVN terms, a branch is just a copy of a
current tree. Lets create a branch to
develop an alternate layout for the site:
svn copy -m creating green site dev branch
svn://path/to/repo/trunk
svn://path/to/repo/branches/wide-layout
(in TortoiseSVN it is under branch/tag in
context menu)
svn://project/path/trunk
You can now switch to a branch by doing
Merging branches
Once completed developing on a branch, you
may want to merge changes back:
Merging branches
$ svn switch
svn://path/to/target/branch
Tags
Tags are markers used for deployment,
mainly for major release versions:
Tags
Tags are copies, exactly like branches:
$ svn copy
-m tagging version 1.1 of the project
svn://path/to/project
svn://path/to/tags/1.1
svn:externals
Externals are links to other repositories:
$ svn propset svn:externals
css/common svn://company/common/css/files
./
Externals are not part of the repository, they are
just fetched with the repository (useful for
deploying applications!)
Best practices
EVERY
COMMIT
MUST
HAVE
DESCRIPTION
Fixed bug
Updated
Saved work
Updating
Merging changes
Optimal process
Suggested
Workflow
This is actually
how
git-flow by
nvie.com handles
development, but
SVN could also
use it!