SVNBOOK Chap2 Basic Work Cycle Examine Your Changes See an overview of your changes

Un article de Framalang Wiki.

Jump to: navigation, search

Cette page fait partie du projet Version control with subversion.


Pseudo Code Rôle Statut
Traduction
Relecture
Validation


Sommaire

[modifier] Titre

See an overview of your changes

[modifier] Paragraphe 1

To get an overview of your changes, you'll use the svn status command. You'll probably use svn status more than any other Subversion command.

[modifier] Paragraphe 2

CVS Users: Hold That Update! You're probably used to using cvs update to see what changes you've made to your working copy. svn status will give you all the information you need regarding what has changed in your working copy—without accessing the repository or potentially incorporating new changes published by other users.

In Subversion, update does just that—it updates your working copy with any changes committed to the repository since the last time you've updated your working copy. You may have to break the habit of using the update command to see what local modifications you've made.

[modifier] Paragraphe 3

If you run svn status at the top of your working copy with no arguments, it will detect all file and tree changes you've made. Below are a few examples of the most common status codes that svn status can return. (Note that the text following # is not actually printed by svn status.)

A stuff/loot/bloo.h # file is scheduled for addition C stuff/loot/lump.c # file has textual conflicts from an update D stuff/fish.c # file is scheduled for deletion

M bar.c # the content in bar.c has local modifications

[modifier] Paragraphe 4

In this output format svn status prints six columns of characters, followed by several whitespace characters, followed by a file or directory name. The first column tells the status of a file or directory and/or its contents. The codes we listed are:

A item

The file, directory, or symbolic link item has been scheduled for addition into the repository.

C item

The file item is in a state of conflict. That is, changes received from the server during an update overlap with local changes that you have in your working copy. You must resolve this conflict before committing your changes to the repository.

D item

The file, directory, or symbolic link item has been scheduled for deletion from the repository.

M item

The contents of the file item have been modified. If you pass a specific path to svn status, you get information about that item alone:

$ svn status stuff/fish.c

D stuff/fish.c

[modifier] Paragraphe 5

svn status also has a --verbose (-v) option, which will show you the status of every item in your working copy, even if it has not been changed:

$ svn status -v

M               44        23    sally     README
                44        30    sally     INSTALL
M               44        20    harry     bar.c
                44        18    ira       stuff
                44        35    harry     stuff/trout.c
D               44        19    ira       stuff/fish.c
                44        21    sally     stuff/things
A                0         ?     ?        stuff/things/bloo.h
                44        36    harry     stuff/things/gloo.c

[modifier] Paragraphe 6

This is the “long form” output of svn status. The letters in the first column mean the same as before, but the second column shows the working-revision of the item. The third and fourth columns show the revision in which the item last changed, and who changed it.

[modifier] Paragraphe 7

None of the prior invocations to svn status contact the repository—instead, they compare the metadata in the .svn directory with the working copy. Finally, there is the --show-updates (-u) option, which contacts the repository and adds information about things that are out-of-date:

$ svn status -u -v
M      *        44        23    sally     README
M               44        20    harry     bar.c
       *        44        35    harry     stuff/trout.c
D               44        19    ira       stuff/fish.c
A                0         ?     ?        stuff/things/bloo.h
Status against revision:   46

[modifier] Paragraphe 8

Notice the two asterisks: if you were to run svn update at this point, you would receive changes to README and trout.c. This tells you some very useful information—you'll need to update and get the server changes on README before you commit, or the repository will reject your commit for being out-of-date. (More on this subject later.)

svn status can display much more information about the files and directories in your working copy than we've shown here—for an exhaustive description of svn status and its output, see svn status.