17. svn checkout
adam:igrad$ svn co svn://io/repos/trunk
A trunk/common.php
A trunk/index.html
A trunk/images
A trunk/images/header.png
Checked out revision 55.
adam:igrad$
19. The Basics Glossing over these. Use
them in preference to
the normal shell
commands (or your
editor’s file browser
functions). svn actions
maintain log history, so
use them.
20. The Basics Glossing over these. Use
them in preference to
the normal shell
commands (or your
editor’s file browser
functions). svn actions
maintain log history, so
use them.
svn add
rm
svn delete
rmdir
svn copy cp
svn move mv
21. The Basics Glossing over these. Use
them in preference to
the normal shell
commands (or your
editor’s file browser
functions). svn actions
maintain log history, so
use them.
svn add
rm
svn delete
rmdir
svn copy cp
svn move mv
22. The Basics Glossing over these. Use
them in preference to
the normal shell
commands (or your
editor’s file browser
functions). svn actions
maintain log history, so
use them.
svn add
rm
svn delete
rmdir
svn copy cp
svn move mv
24. svn checkin
Flags are a good way to
commit more than you
intended. Leave them
out and svn will prompt
you for a message.
check_deps
https://io.plymouth.edu/
trac/search
svn ci -F message.txt
svn ci -m ‘making some changes’
25. svn checkin
Flags are a good way to
commit more than you
intended. Leave them
out and svn will prompt
you for a message.
check_deps
https://io.plymouth.edu/
trac/search
svn ci -F message.txt
svn ci -m ‘making some changes’
26. svn checkin
Flags are a good way to
commit more than you
intended. Leave them
out and svn will prompt
you for a message.
check_deps
https://io.plymouth.edu/
trac/search
svn ci -F message.txt
svn ci -m ‘making some changes’
27. You will probably need to
svn checkin
define your editor. This
code does it
automatically at login.
tcsh$ echo setenv EDITOR vi >> ~/.cshrc
bash$ echo export EDITOR=vi >> ~/.bashrc
28. svn checkin Checkin after distinct
changes. Simplify
rollbacks, keep out the
cruft when we look at
changesets.
Project TODO:
•Verbiage changes
•Update to authZ/authN
•Alphabetize functions.php
29. svn checkin Checkin after distinct
changes. Simplify
rollbacks, keep out the
cruft when we look at
changesets.
Project TODO:
•Verbiage changes svn ci
•Update to authZ/authN
•Alphabetize functions.php
30. svn checkin Checkin after distinct
changes. Simplify
rollbacks, keep out the
cruft when we look at
changesets.
Project TODO:
•Verbiage changes svn ci
•Update to authZ/authN svn ci
•Alphabetize functions.php
31. svn checkin Checkin after distinct
changes. Simplify
rollbacks, keep out the
cruft when we look at
changesets.
Project TODO:
•Verbiage changes svn ci
•Update to authZ/authN svn ci
•Alphabetize functions.php svn ci
32. This should become habit.
svn update
Prevent conflicts
(changing lines of code
that have already been
changed in the repos).
Can’t checkin an out-of-
date working directory.
Update working directory from the remote
repository.
•Before you start editing
•Before you commit
33. svn update
Update multiple directories/files in one pass.
svn up /web/includes_psu/PSUDatabase.class.php
> /web/includes_external/adodb5
> /web/pscpages/webapp/ape/common.php
34. Should also become habit.
svn status
You’re scheduling
commits for a reason,
don’t let older changes
creep into your commit.
Lots of codes to choose
from.
Summarize changes in working directory.
•Before you start editing
•Before you commit
M images/title.png
A includes
? includes/functions.php
D common.php
35. Should also become habit.
svn status
You’re scheduling
commits for a reason,
don’t let older changes
creep into your commit.
Lots of codes to choose
from.
Summarize changes in working directory.
•Before you start editing
•Before you commit
M images/title.png
A includes
? includes/functions.php
D common.php
36. Should also become habit.
svn status
You’re scheduling
commits for a reason,
don’t let older changes
creep into your commit.
Lots of codes to choose
from.
Summarize changes in working directory.
•Before you start editing
•Before you commit
M images/title.png
A includes
? includes/functions.php
D common.php
37. Should also become habit.
svn status
You’re scheduling
commits for a reason,
don’t let older changes
creep into your commit.
Lots of codes to choose
from.
Summarize changes in working directory.
•Before you start editing
•Before you commit
M images/title.png
A includes
? includes/functions.php
D common.php
38. Should also become habit.
svn status
You’re scheduling
commits for a reason,
don’t let older changes
creep into your commit.
Lots of codes to choose
from.
Summarize changes in working directory.
•Before you start editing
•Before you commit
M images/title.png
A includes
? includes/functions.php
D common.php
39. svn help
svn help status
svn help commit
svn help checkout
svn help di
svn help blame
Version Control with Subversion
http://svnbook.red-bean.com/
40. Structure
svn://io/repos/trunk Production Code
Development
svn://io/repos/branches Branches
svn://io/repos/tags Named Snapshots
41. The current state of our
Trunk
web world.
Should be able to
checkout trunk at any
time to bring up a new
server.
Our “Real” applications
New web server = new trunk checkout
42. Break out a code base
Branches
into its own world.
Allows you to commit
changes to an application
without affecting the
trunk.
svn://io/repos/branches/ape-authz svn://
io/repos/branches/igrad-1-0
svn://io/repos/branches/surplus-porter
43. Directories locked in
Tags
time. Snapshots.
“Locked” only by
convention.
Tags give revision
numbers a name.
svn://io/repos/tags/ape-1-0
svn://io/repos/tags/adodb-5-0-8
ape-1-0 ape-1-1 ape-2-0
44. Directories locked in
Structure
time. Snapshots.
“Locked” only by
convention.
Tags give revision
numbers a name.
branches/
trunk/
tags/
60. Use diff to pull out
svn diff
uncommitted changes
into a single file. Email file
around, save for later,
etc. Alternative to
branching.
adam@flit:project$ svn di changes.di # archive
adam@flit:project$ svn revert -R . # back out changes
[edit files, merge, cp, etc.]
adam@flit:project$ svn ci # checkin new changes
adam@flit:project$ patch -p0 changes.di # apply archive
61. Show changes bet ween
svn diff
last checked out version
(NOT including changes
we made) and the most
recent version.
adam@flit:project$ svn di -r BASE:HEAD
63. svn copy
Copies are cheap. Same
files on the backend, just
a new name for them.
Create tags and branches
the same way.
adam@flit:project$ svn cp svn://io/repos/trunk
svn://io/repos/branches/banner8
Committed revision 12.
adam@flit:project$
64. svn sw
Easy to switch bet ween
trees. Also easy to shoot
yourself in the foot.
(Coming up next slide.)
adam@flit:project$ svn sw
svn://io/repos/branches/banner8
At revision 3.
adam@flit:project$
65. svn sw
See that switching bet ween
branches will update all files
within that branch.
Unpredictable if you switch
bet ween t wo unrelated
directories. Works fine
bet ween t wo “clean” checkouts
with no modifications.
adam@flit:project$ svn sw
svn://io/repos/branches/banner8
U index.html
D includes/functions.inc.php
A includes/functions.php
Updated to revision 4.
adam@flit:project$
66. svn sw
Switching with changes in the
tree. Will merge if possible.
Works fine if you are working
on trunk, then create a branch
and switch to it. (Changes from
trunk will be applied to branch
cleanly.) You’ll get conflicts if
you switch back to trunk.
adam@flit:project$ svn sw
svn://io/repos/branches/banner8
G index.html
Updated to revision 5.
adam@flit:project$
67. svn info
Find out where you are.
adam@flit:project$ svn sw
svn://io/repos/branches/banner8
adam@flit:project$ svn info
Path: .
URL: svn://io/repos/branches/banner8
Repository Root: svn://io/repos/
Repository UUID: bb1ebae7-95e1-0310-b179-bb68cf00a8bd
Revision: 55
Node Kind: directory
Schedule: normal
Last Changed Author: adam
Last Changed Rev: 55
Last Changed Date: 2009-03-30 21:21:56 -0400 (Mon, 30 …
73. svn merge
adam@flit:project$ svn sw [branch path]
adam@flit:project$ vi index.html common.php
adam@flit:project$ svn rm images/header.big.png
adam@flit:project$ svn ci
Sending index.html
Sending common.php
Deleting images/header.big.png
Committed revision 9.
adam@flit:project$ svn merge -r5:9 svn://io/repos/trunk .
U index.html
A images/background.png
adam@flit:project$ svn ci
74. svn merge
adam@flit:project$ svn sw [branch path]
adam@flit:project$ vi index.html common.php
adam@flit:project$ svn rm images/header.big.png
adam@flit:project$ svn ci
Sending index.html
Sending common.php
Deleting images/header.big.png
Committed revision 9.
adam@flit:project$ svn merge -r5:9 svn://io/repos/trunk .
U index.html
A images/background.png
Range of revisions since
adam@flit:project$ svn ci
branch broke from trunk
75. svn merge
Imagine a timeline like
this: branch created in
rev 4, changes made to
trunk and branch,
currently at rev 12. How
to merge in new changes
from trunk 6 and 9-12?
trunk/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
branches/rel-1-1/
76. svn merge
Imagine a timeline like
this: branch created in
rev 4, changes made to
trunk and branch,
currently at rev 12. How
to merge in new changes
from trunk 6 and 9-12?
trunk/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
branches/rel-1-1/
77. svn merge
Imagine a timeline like
this: branch created in
rev 4, changes made to
trunk and branch,
currently at rev 12. How
to merge in new changes
from trunk 6 and 9-12?
trunk/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
branches/rel-1-1/
svn merge -r4:HEAD svn://io/repos/trunk .