Sub Version Intro

Click here to load reader

  • date post

  • Category


  • view

  • download


Embed Size (px)

Transcript of Sub Version Intro

  • 1. A day with Subversion (SVN)Sebastian HeimannInstitut fr Geophysik, Arbeitsgruppe Seismologie uFebruary 15, 2007

2. Outline 1. Concepts (by example) 2. Vocabulary 3. Benets 4. Further reading 3. The initial workLets assume we have just made a quick and dirty hack, which wenow want to put under version contol for further development: > ls /my/hack 4. Create an empty repository> svnadmin create --fs-type fsfs /my/reposRepository 5. The initial import > svn import /my/hack file:///my/repos/hack/trunk-m Initial importRepository1 6. Checkout a working copy of hack> svn checkout file:///my/repos/hack/trunk /work/hackRepositoryWorking copy 1 7. Add a new feature to hack > cd /work/hack ; vi hack RepositoryWorking copy 1 8. Commit your changes to the repository > svn commitRepositoryWorking copy2 1 9. More than one person can now work on hackRepository Fus working copy 2Faras working copy 1 10. Both implement their improvementsRepository Fus working copy 2Faras working copy 1 11. Fu commits his changes to the repositoryRepository > svn commit3Faras working copyFus working copy21 12. Fara commits her changes to the repositoryRepository 4 > svn commitFus working copy3 Faras working copy21 13. To get each others changesRepository4> svn update > svn update3Fus working copyFaras working copy 2 1 14. Fu and Fara can go back to any previous revisionRepository 4> svn update -r 1 > svn update -r 3 3 Fus working copyFaras working copy21 15. Internally the repository will only store dierences... Repository 4321 16. ...but it pretends to make a new copy on every commit.Repository 4321 17. Sometimes it may be useful to branch the project...> svn cp -r 2 file:///my/repos/hack/trunk file:///my/repos/hack/branches/mad 18. ...this creates a copy directly in the repository.43.../trunk .../branches/mad2 51 19. Check out a working copy of the branch> svn checkout file:///my/repos/hack/branches/mad/work/mad-hack 20. You can now safely experiment with mad-hack, while maintaining a stable version of hack in the trunk. 4> cd /work/mad-hack > # edit it36 25 1 > svn commit 21. Tagging: You can also use the branching mechanism to mark a specic revisions as somehow special.> svn cp -r 2 file:///my/repos/hack/trunk file:///my/repos/hack/tags/stable-v1 22. Tagged stable version 1 of hack 4 3 .../trunk .../tags/stable-v1 2 5 1 23. Vocabulary repository revision working copy to check out to commit to update 24. Vocabulary to branch to merge to tag 25. Conventions hack/trunk hack/branches/mad hack/tags/stable-v1 26. Benets Unlimited undo! Collaborate with others! Enforces structured development Makes you document what you are doing Automatic changelog! Helps you organize your mess in $HOME 27. Further readingTutorial Documentation (A good intro is in Chapter 2) help> svn help> svn [command] help