svn help [command-name]
supplies help about how to use Subversion.
svn co repository [dir-name]
checks out repository.
If dir-name is supplied, then that is used as the name
for the freshly created directory holding the repository.
Otherwise uses the base name of the repository itself.
svn add path
schedules path in the working directory for addition at the next commit.
svn rm path
deletes path from the working direcory,
and schedules path to be removed from the repository at the next commit.
svn commit
commit changes from working directory. It will try to
bring up your choice of editor to make a log message, or you can use the -m
option to pass a log message on the command line. (This is what I do in the transcript below.)
svn up
updates the working directory
to the latest revision in the central repository, attempting to merge changes when it can.
status notifications:
A
: If a file is added by this process, its name is printed
with an added notification A
.
D
If a file is deleted by this process, its name is printed
with an deleted notification D
.
U
If a locally-unchanged file is updated by this process, its name is printed with
an updated notification U
.
G
If a locally-changed file is "successfully" merged with changes made in the
central repository, its name is printed with a merged notification G
.
C
If a change has been made to a line of a file, and you also changed that line in your copy of the file, then:
C
file.mine
file.rnumber-of-revision
file.rnumber-of-revision
svn status
summarizes the status of changes to the working directoy; if there
are no changes from the revision you checked out, then no output is printed.
If a file was marked as having a conflict that has not been resolved, its name is printed
with the conflict marker C
. Otherwise, if a file is locally modified, its name is printed with the modified marker M
.
svn resolved file
removes the conflict mark from file,
and removes the three copies of the variants of file
that were generated when you performed the svn update
(see above).
svn diff [file]
summarizes the changes you have made to files
in the working directory.
svn revert path
reverts path to the form it
had when you checked it out from the repository.
(It does not update it to the latest version, though.)
What follows is an annotated transcript of a series of shell commands that I executed to demonstrate the commands above.
You should look carefully at the portion of the
transcript where I attempt to do svn commit -m "Adding everyone to salutation."
.
That section illustrates a subversion conflict, shows the
four files that are generated by the svn update
that revealed
the conflict, and illustrates how to use the svn resolved
command to remove the conflict marking after one has fixed the problem.
pnkfelix% export REPOSITORY_ROOT=svn+ssh://pnkfx.org/Users/pnkfelix/SvnRoot/WorkLog/test pnkfelix% svn co $REPOSITORY_ROOT test-1 Checked out revision 50. pnkfelix% ls test-1 pnkfelix% ls -a test-1 . .. .svn pnkfelix% cd test-1 test-1% cat > file.txt Hi there. The first line. This is the second line. And a third line.
I will now switch to a tabular format, so that you can see how
changes to two distinct checkouts (named test-1
and
test-2
) propagate up to the repository and down to the
checkouts.
(I apologize for the width of the presentation. The most important thing to read is the sequence of shell commands, to see what messages Subversion delivers, and how one invokes commands to deal with updates and conflicts.)
repository file.txt | test-1 file.txt | test-2 file.txt | shell commands |
---|---|---|---|
(nothing) | Hi there. The first line. This is the second line. And a third line. | (nothing) | |
test-1% svn add file.txt A file.txt | |||
test-1% svn commit -m "Committing file to demonstrate svn commands." file.txt Adding file.txt Transmitting file data . Committed revision 51. | |||
Hi there. The first line. This is the second line. And a third line. | |||
test-1% cd .. | |||
pnkfelix% svn co $REPOSITORY_ROOT test-2 A test-2/file.txt Checked out revision 51. | |||
Hi there. The first line. This is the second line. And a third line. | |||
pnkfelix% ls test-1 file.txt | |||
pnkfelix% ls test-2 file.txt | |||
pnkfelix% ls -a test-1 . .. .svn file.txt | |||
pnkfelix% ls -a test-1/.svn . entries prop-base text-base .. format props tmp | |||
pnkfelix% ls -a test-2 . .. .svn file.txt | |||
pnkfelix% cd test-2 | |||
test-2% cat file.txt Hi there. The first line. This is the second line. And a third line. | |||
test-2% cat > file.txt Hello there. The first line. This is the second line. And a third line. | |||
Hello there. The first line. This is the second line. And a third line. | |||
test-2% svn diff file.txt Index: file.txt =================================================================== --- file.txt (revision 51) +++ file.txt (working copy) @@ -1,3 +1,3 @@ -Hi there. The first line. +Hello there. The first line. This is the second line. And a third line. | |||
test-2% svn commit -m "Changed Hi to Hello in first line." file.txt Sending file.txt Transmitting file data . Committed revision 52. | |||
Hello there. The first line. This is the second line. And a third line. | |||
test-2% cd ../test-1 | |||
test-1% ls file.txt | |||
test-1% cat file.txt Hi there. The first line. This is the second line. And a third line. | |||
test-1% svn up U file.txt Updated to revision 52. | |||
Hello there. The first line. This is the second line. And a third line. | |||
test-1% cat file.txt Hello there. The first line. This is the second line. And a third line. | |||
test-1% cat > file.txt Hello there. The first line. This is a second line. And a third line. | |||
Hello there. The first line. This is a second line. And a third line. | |||
test-1% cat file.txt Hello there. The first line. This is a second line. And a third line. | |||
test-1% svn diff Index: file.txt =================================================================== --- file.txt (revision 52) +++ file.txt (working copy) @@ -1,3 +1,3 @@ Hello there. The first line. -This is the second line. +This is a second line. And a third line. | |||
test-1% cd ../test-2 | |||
test-2% svn up At revision 52. | |||
test-2% svn status | |||
test-2% cat > file.txt Hello there. The first line. This is the second line. And the third line. | |||
Hello there. The first line. This is the second line. And the third line. | |||
test-2% svn diff Index: file.txt =================================================================== --- file.txt (revision 52) +++ file.txt (working copy) @@ -1,3 +1,3 @@ Hello there. The first line. This is the second line. -And a third line. +And the third line. | |||
test-2% svn commit -m "A small change to the third line." file.txt Sending file.txt Transmitting file data . Committed revision 53. | |||
Hello there. The first line. This is the second line. And the third line. | |||
test-2% cd ../test-1 | |||
test-1% svn diff Index: file.txt =================================================================== --- file.txt (revision 52) +++ file.txt (working copy) @@ -1,3 +1,3 @@ Hello there. The first line. -This is the second line. +This is a second line. And a third line. | |||
test-1% svn status M file.txt | |||
test-1% svn up G file.txt Updated to revision 53. | |||
Hello there. The first line. This is a second line. And the third line. | |||
test-1% svn diff Index: file.txt =================================================================== --- file.txt (revision 53) +++ file.txt (working copy) @@ -1,3 +1,3 @@ Hello there. The first line. -This is the second line. +This is a second line. And the third line. | |||
test-1% cat file.txt Hello there. The first line. This is a second line. And the third line. | |||
test-1% svn commit -m "a small change to the second line." file.txt Sending file.txt Transmitting file data . Committed revision 54. | |||
Hello there. The first line. This is a second line. And the third line. | |||
test-1% cat > file.txt Hello there. Great first line. This is a second line. And the third line. | |||
Hello there. Great first line. This is a second line. And the third line. | |||
test-1% svn diff file.txt Index: file.txt =================================================================== --- file.txt (revision 54) +++ file.txt (working copy) @@ -1,3 +1,3 @@ -Hello there. The first line. +Hello there. Great first line. This is a second line. And the third line. | |||
test-1% cd ../test-2 | |||
test-2% svn status | |||
test-2% svn up U file.txt Updated to revision 54. | |||
test-2% cat file.txt Hello there. The first line. This is a second line. And the third line. | |||
test-2% cat > file.txt Hello there everyone. The first line. This is a second line. And the third line. | |||
Hello there everyone. The first line. This is a second line. And the third line. | |||
test-2% svn diff Index: file.txt =================================================================== --- file.txt (revision 54) +++ file.txt (working copy) @@ -1,3 +1,3 @@ -Hello there. The first line. +Hello there everyone. The first line. This is a second line. And the third line. | |||
test-2% cd ../test-1 | |||
test-1% svn diff Index: file.txt =================================================================== --- file.txt (revision 54) +++ file.txt (working copy) @@ -1,3 +1,3 @@ -Hello there. The first line. +Hello there. Great first line. This is a second line. And the third line. | |||
test-1% svn commit -m "deliberate changing first line to conflict w/ test-2" Sending file.txt Transmitting file data . Committed revision 55. | |||
Hello there. Great first line. This is a second line. And the third line. | |||
test-1% cd ../test-2 | |||
test-2% ls file.txt | |||
test-2% cat file.txt Hello there everyone. The first line. This is a second line. And the third line. | |||
test-2% svn diff Index: file.txt =================================================================== --- file.txt (revision 54) +++ file.txt (working copy) @@ -1,3 +1,3 @@ -Hello there. The first line. +Hello there everyone. The first line. This is a second line. And the third line. | |||
test-2% svn commit -m "Adding everyone to salutation." Sending file.txt Transmitting file data .svn: Commit failed (details follow): svn: Out of date: '/test/file.txt' in transaction '1l' | |||
test-2% ls file.txt | |||
test-2% svn up C file.txt Updated to revision 55. | |||
<<<<<<< .mine Hello there everyone. The first line. ======= Hello there. Great first line. >>>>>>> .r55 This is a second line. And the third line. | |||
test-2% ls file.txt file.txt.mine file.txt.r54 file.txt.r55 | |||
test-2% cat file.txt.mine Hello there everyone. The first line. This is a second line. And the third line. | |||
test-2% cat file.txt.r54 Hello there. The first line. This is a second line. And the third line. | |||
test-2% cat file.txt.r55 Hello there. Great first line. This is a second line. And the third line. | |||
test-2% cat file.txt <<<<<<< .mine Hello there everyone. The first line. ======= Hello there. Great first line. >>>>>>> .r55 This is a second line. And the third line. | |||
test-2% cat > file.txt Hello there everyone. Great first line. This is a second line. And the third line. | |||
Hello there everyone. Great first line. This is a second line. And the third line. | |||
test-2% cat file.txt Hello there everyone. Great first line. This is a second line. And the third line. | |||
test-2% ls file.txt file.txt.mine file.txt.r54 file.txt.r55 | |||
test-2% svn status ? file.txt.mine ? file.txt.r54 ? file.txt.r55 C file.txt | |||
test-2% svn commit -m "Adding everyone to salutation." svn: Commit failed (details follow): svn: Aborting commit: '/Users/pnkfelix/test-2/file.txt' remains in conflict | |||
test-2% ls file.txt file.txt.mine file.txt.r54 file.txt.r55 | |||
test-2% svn status ? file.txt.mine ? file.txt.r54 ? file.txt.r55 C file.txt | |||
test-2% svn resolved file.txt Resolved conflicted state of 'file.txt' | |||
test-2% ls file.txt | |||
test-2% svn commit -m "Adding everyone to salutation." Sending file.txt Transmitting file data . Committed revision 56. | |||
Hello there everyone. Great first line. This is a second line. And the third line. | |||
test-2% svn status | |||
test-2% cd ../test-1 | |||
test-1% svn status | |||
test-1% svn up U file.txt Updated to revision 56. | |||
Hello there everyone. Great first line. This is a second line. And the third line. | |||
test-1% ls file.txt | |||
test-1% cat file.txt Hello there everyone. Great first line. This is a second line. And the third line. | |||
test-1% cat > file.txt Whoops I'm trampling all over the file whhooaooaoaaoaoaaaa | |||
Whoops I'm trampling all over the file whhooaooaoaaoaoaaaa | |||
test-1% cat file.txt Whoops I'm trampling all over the file whhooaooaoaaoaoaaaa | |||
test-1% svn diff Index: file.txt =================================================================== --- file.txt (revision 56) +++ file.txt (working copy) @@ -1,3 +1,3 @@ -Hello there everyone. Great first line. -This is a second line. -And the third line. +Whoops I'm trampling +all over the file +whhooaooaoaaoaoaaaa | |||
test-1% svn revert file.txt Reverted 'file.txt' | |||
Hello there everyone. Great first line. This is a second line. And the third line. | |||
test-1% cat file.txt Hello there everyone. Great first line. This is a second line. And the third line. | |||
test-1% rm file.txt | |||
(nothing) | |||
test-1% svn status ! file.txt | |||
test-1% svn revert file.txt Reverted 'file.txt' | |||
Hello there everyone. Great first line. This is a second line. And the third line. | |||
test-1% svn status | |||
test-1% cat file.txt Hello there everyone. Great first line. This is a second line. And the third line. | |||
test-1% ls file.txt | |||
test-1% svn rm file.txt D file.txt | |||
(nothing) | |||
test-1% ls | |||
test-1% svn status D file.txt | |||
test-1% cd ../test-2 | |||
test-2% svn status | |||
test-2% svn up At revision 56. | |||
test-2% ls file.txt | |||
test-2% cat file.txt Hello there everyone. Great first line. This is a second line. And the third line. | |||
test-2% cd ../test-1 | |||
test-1% svn status D file.txt | |||
test-1% svn commit -m "show that svn rm needs to be committed." Deleting file.txt Committed revision 57. | |||
(nothing) | |||
test-1% svn status | |||
test-1% cd ../test-2 | |||
test-2% ls file.txt | |||
test-2% svn status | |||
test-2% svn up D file.txt Updated to revision 57. | |||
(nothing) | |||
test-2% svn status | |||
test-2% ls | |||
test-2% |
Felix S Klock II