April 24, 2010: We are pleased to announce that Version 4 of this course is now under development. For updates and an early peek at the content, please check out the Software Carpentry blog at http://www.software-carpentry.org/blog/.
print statements
Figure 6.1: Managing Multi-Author Collaboration
Figure 6.2: Version Control as a Time Machine
solarsystem project repository
svn update to synchronize his working copy with the repositoryjupiter directory and creates moons.txtName Orbital Radius Orbital Period Mass Radius Io 421.6 1.769138 893.2 1821.6 Europa 670.9 3.551181 480.0 1560.8 Ganymede 1070.4 7.154553 1481.9 2631.2 Callisto 1882.7 16.689018 1075.9 2410.3
svn add moons.txt to bring it to [Subversion]'s noticesvn commit to save his changes in the repository
svn update on her working copy
Figure 6.3: The Basic Edit/Update Cycle
Figure 6.4: SmartSVN
Figure 6.5: TortoiseSVN
moons.txt and commits his changes to create version 152Name Orbital Radius Orbital Period Mass Radius Io 421.6 1.769138 893.2 1821.6 Europa 670.9 3.551181 480.0 1560.8 Ganymede 1070.4 7.154553 1481.9 2631.2 Callisto 1882.7 16.689018 1075.9 2410.3 Amalthea 181.4 0.498179 0.075 131 x 73 x 67 Himalia 11460 250.5662 0.095 85 Elara 11740 259.6528 0.008 40
moons.txt (remember she is working from version 151 as her base)Name Orbital Radius Orbital Period Mass Radius
(10**3 km) (days) (10**20 kg) (km)
Io 421.6 1.769138 893.2 1821.6
Europa 670.9 3.551181 480.0 1560.8
Ganymede 1070.4 7.154553 1481.9 2631.2
Callisto 1882.7 16.689018 1075.9 2410.3
Amalthea 181.4 0.498179 0.075 131
Himalia 11460 250.5662 0.095 85
Elara 11740 259.6528 0.008 40
Pasiphae 23620 743.6 0.003 18
Sinope 23940 758.9 0.0008 14
Lysithea 11720 259.22 0.0008 12
Figure 6.6: Merging Conflicts
moons.txt (Hermione's local copy)
Name Orbital Radius Orbital Period Mass Radius
(10**3 km) (days) (10**20 kg) (km)
Io 421.6 1.769138 893.2 1821.6
Europa 670.9 3.551181 480.0 1560.8
Ganymede 1070.4 7.154553 1481.9 2631.2
Callisto 1882.7 16.689018 1075.9 2410.3
<<<<<<< .mine
Amalthea 181.4 0.498179 0.075 131
Himalia 11460 250.5662 0.095 85
Elara 11740 259.6528 0.008 40
Pasiphae 23620 743.6 0.003 18
Sinope 23940 758.9 0.0008 14
Lysithea 11720 259.22 0.0008 12
=======
Amalthea 181.4 0.498179 0.075 131 x 73 x 67
Himalia 11460 250.5662 0.095 85
Elara 11740 259.6528 0.008 40
>>>>>>> .r152
<<<<<<< shows the start of the section from the first file======= divides sections>>>>>>>> shows the end of the section from the second filemoons.txt.mine: contains Hermione's changesmoons.txt.151: the file before either set of changesmoons.txt.152: the most recent version of the file in the repositorysvn revert moons.txt to throw away her changesmoons.txtmoons.txt to remove the conflict markerssvn resolved moons.txt to let [Subversion] know she's donesvn commit to commit her changes (creating version 153 of the repository)svn diff shows him which files he has changed, and what those changes aresvn revert to discard his work
moons.txt
svn log shows recent history
svn merge -r 157:156 moons.txt will do the trick
-r flag specifies the revisions involved
Figure 6.7: Rolling Back
/svn/rotor)cd /svnsvnadmin create rotorsvn checkout file:///svn/rotorsvn checkout http://www.hogwarts.edu/svn/rotor
svn checkout once, to initialize your working copy
svn update in that directorysvn co http://www.hogwarts.edu/svn/rotor/engine/dynamics| Name | Purpose | Example |
|---|---|---|
svn add |
Add files and/or directories to version control. | svn add newfile.c newdir |
svn checkout |
Get a fresh working copy of a repository. | svn checkout https://your.host.name/rotor/repo rotorproject |
svn commit |
Send changes from working copy to repository (inverse of update). |
svn commit -m "Comment on the changes" |
svn delete |
Delete files and/or directories from version control. | svn delete oldfile.c |
svn diff |
Shows changes for directories/files in a unified diff format. | svn diff somefile.c |
svn help |
Get help (in general, or for a particular command). | svn help update |
svn log |
Show history of recent changes. | svn log --verbose *.c |
svn merge |
Merge two different versions of a file into one. | svn merge -r 18:16 spin.c |
svn mkdir |
Create a new directory and put it under version control. | svn mkdir newmodule |
svn rename |
Rename a file or directory, keeping track of history. | svn rename temp.txt release_notes.txt |
svn revert |
Undo changes to working copy (i.e., resynchronize with repository). | svn revert spin.h |
svn status |
Show the status of files and directories in the working copy. | svn status |
svn update |
Bring changes from repository into working copy (inverse of commit). |
svn update |
Table 6.1: Common Subversion Commands
svn status compares your working copy with the repository
$ svn status - M jupiter/moons.txt - C readme.txt
jupiter/moons.txt has been modifiedreadme.txt has conflictssvn update prints one line for each file or directory it does something to$ svn update - A saturn/moons.txt - U mars/mars.txt
saturn/moons.txt has been addedmars/mars.txt has been updated (i.e., someone else modified it)
Figure 6.8: SmartSVN Startup
Figure 6.9: SmartSVN Import - Local Directory
Figure 6.10: SmartSVN Import - Repository
Figure 6.11: SmartSVN Repository Profiles
Figure 6.12: SmartSVN New Profile - Location
Figure 6.13: SmartSVN New Profile - Details
Figure 6.14: SmartSVN New Profile - Name
Figure 6.15: SmartSVN Import - Repository (Redux)
Figure 6.16: SmartSVN Import - Location
Figure 6.17: SmartSVN Import - Project
Figure 6.18: SmartSVN Import - Summary
Figure 6.19: SmartSVN Project Window
Copyright © 2005-09 Python Software Foundation.
Created Thu Aug 6 21:56:06 2009 UTC