| prev | Draft Version 534 (Mon Dec 5 17:02:10 2005) | next |
Subversion site for detailssvn update to bring his copy up to date with the repositoryspin.c and spin.hsvn commit to save those changes in the repositorysvn update again, just in case Hermione has also been making changes (she hasn't)spin.c againsvn commit a second timesvn update on her working copyRapidSVN runs on Windows, Linux, and MacTortoiseSVN is a Windows shell extensionSmartSVNspin.c version 15int maxRotateSetting(int * available, int length)
{
int i, maxFound;
if (length == 0) {
return 0;
}
for (i=0; i<length; i+=1) {
if (available[i] > maxFound) {
maxFound = available[i];
}
}
return maxFound;
}
spin.c version 16// Find maximum rotation setting from those available,
// or 0 if none are available.
int maxRotateSetting(int * available, int length)
{
int i, maxFound;
if (length == 0) {
return 0;
}
for (i=0; i<length; i+=1) {
if (available[i] > maxFound) {
maxFound = available[i];
}
}
return maxFound;
}
// Find maximum rotation setting, or 0.
int maxRotateSetting(int * available, int length)
{
int i, maxFound = 0;
for (i=0; i<length; i+=1) {
if (available[i] > maxFound) {
maxFound = available[i];
}
}
return maxFound;
}
<<<<<<< .mine
// Find maximum rotation setting, or 0.
=======
// Find maximum rotation setting from those available,
// or 0 if none are available.
>>>>>>> .r471
int maxRotateSetting(int * available, int length)
{
int i, maxFound = 0;
for (i=0; i<length; i+=1) {
if (available[i] > maxFound) {
maxFound = available[i];
}
}
return maxFound;
}
spin.c.mine, spin.c.15, and spin.c.16 for referencesvn resolved spin.c to tell Subversion the conflict has been fixedsvn commit spin.c to create spin.c version 17spin.c”, but in fact there is no such thingsvn diff will show him which files he has changed, and what those changes aresvn revert to re-synchronize with the master copyspin.c
svn log shows recent historysvn merge -r 17:16 spin.c means “merge changes, going from version 17 to version 16” (i.e., backwards)
/rotor/repo)cd /rotorsvnadmin create repofile:///rotor/repo
https://your.host.name/rotor/repo
https (instead of http) means “use a secure connection”svn checkout https://your.host.name/rotor/reporepo
svn checkout https://your.host.name/rotor/repo rotorprojectsvn checkout once, to initialize your working copy| 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 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 |
svn status compares your working copy with the repository, printing one line for each file that's worth talking about$ svn status
M spin.c MC readme.txt
spin.c has been modifiedreadme.txt has been modified, and has conflictssvn update prints one line for each file or directory it does something to$ svn update
A newspin.c U spin.c C spin.h
newspin.c has been addedspin.c has been updated (i.e., someone else modified it)spin.h
Exercise 3.1:
Follow the instructions given to you by your instructor to
check out a copy of the Subversion repository you'll be using in
this course. Unless otherwise noted, the exercises below
assume that you have done this, and that your working copy is in
a directory called course. You will submit all of your
exercises in this course by checking files into your
repository.
Exercise 3.2:
Create a file course/ex01/bio.txt (where
course is the root of your working copy of your
Subversion repository), and write a short biography of yourself
(100 words or so) of the kind used in academic journals,
conference proceedings, etc. Commit this file to your
repository. Remember to provide a meaningful comment when
committing the file!
Exercise 3.3:
What's the difference between mv and svn
mv? Put the answer in a file called
course/ex01/mv.txt and commit your changes.
Once you have committed your changes, type svn
log in your course directory. If you didn't know
what you'd just done, would you be able to figure it out from
the log messages? If not, why not?
Exercise 3.4:
In this exercise, you'll simulate the actions of two people editing a single file. To do that, you'll need to check out a second copy of your repository. One way to do this is to use a separate computer (e.g., your laptop, your home computer, or a machine in the lab). Another is to make a temporary directory, and check out a second copy of your repository there. Please make sure that the second copy isn't inside the first, or vice versa—Subversion will become very confused.
Let's call the two working copies Blue and Green. Do the following:
a) Create Blue/ex01/planets.txt, and add the
following lines:
Mercury Venus Earth Mars Jupiter Saturn
Commit the file.
b) Update the Green repository. (You should get a copy of
planets.txt.)
c) Change Blue/ex01/planets.txt so that it reads:
1. Mercury 2. Venus 3. Earth 4. Mars 5. Jupiter 6. Saturn
Commit the changes.
d) Edit Green/ex01/planets.txt so that its contents
are as shown below. Do not do svn update
before editing this file, as that will spoil the
exercise.
Mercury 0 Venus 0 Earth 1 Mars 2 Jupiter 16 (and counting) Saturn 14 (and counting)
e) Now, in Green, do svn update. Subversion
should tell you that there are conflicts in planets.txt.
Resolve the conflicts so that the file contains:
1. Mercury 0 2. Venus 0 3. Earth 1 4. Mars 2 5. Jupiter 16 6. Saturn 14
Commit the changes.
f) Update the Blue repository, and check that
planets.txt now has the same content as it has in the
Green repository.
Exercise 3.5:
Add another line or two to course/ex01/bio.txt and
commit those changes. Then, use svn merge to restore
the original contents of your biography
(course/ex01/bio.txt), and commit the result. When you
are done, bio.txt should look the way it did at the end
of the first part of the previous exercise.) Note: the purpose
of this exercise is to teach you how to go back in time to get
old versions of files—while it would be simpler in this
case just to edit bio.txt, you can't (reliably) do that
when you've made larger changes, to multiple files, over a
longer period of time.
| prev | Copyright © 2005, Python Software Foundation. See License for details. | next |