SVNBOOK Chap2 Basic Work Cycle Examine Your Changes
Un article de Framalang Wiki.
Cette page fait partie du projet Version control with subversion.
| Pseudo | Code | Rôle | Statut |
|---|---|---|---|
| Hotshot92 | Traduction | terminé | |
| Relecture | |||
| Validation |
Sommaire |
[modifier] Titre
[modifier] Paragraphe 1
[modifier] Paragraphe 2
- Look Ma! No Network!
- The commands svn status, svn diff, and svn revert can be used without any network access even if your repository is across the network. This makes it easy to manage your changes-in-progress when you are somewhere without a network connection, such as travelling on an airplane, riding a commuter train or hacking on the beach.[5]
Rechercher Ma! Pas de réseau!
Les commandes svn status, svn diff, et svn revert peuvent être utilisés sans accès au réseau même si votre référentiel est distant. C'est ainsi plus facile de gérer vos changements lorsque vous êtes isolé, dans un avion, dans un train de banlieue ou même sur la plage [5].- Subversion does this by keeping private caches of pristine versions of each versioned file inside of the .svn administrative areas. This allows Subversion to report—and revert—local modifications to those files without network access. This cache (called the “text-base”) also allows Subversion to send the user's local modifications during a commit to the server as a compressed delta (or “difference”) against the pristine version. Having this cache is a tremendous benefit—even if you have a fast net connection, it's much faster to send only a file's changes rather than the whole file to the server.
[modifier] Paragraphe 3
Subversion a été optimisé pour vous aider dans cette tâche, et est capable de faire beaucoup de choses sans communiquer avec le dépôt. En particulier, votre copie de travail contient un original de chaque fichier versionné dans la répertoire .svn. C'est pour ça que Subversion peut rapidement vous montrer comment vos fichiers ont changé, ou même vous permettre d'annuler vos changements sans contacter le dépôt.
[modifier] Paragraphe 4
[modifier] Paragraphe 5
- 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.
- Vous avez certainement l'habitude d'utiliser cvs update pour visualiser les changements que vous avez effectués sur votre copie de travail. svn status vous donnera toutes les informations utiles à ce propos sans accès au dépôt et sans incorporer les changements effectués par les autres utilisateurs.
- 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.
- Dans Subversion, update ne fait que mettre à jour : il met à jour votre copie de travail avec tous les changements validés sur le dépôt depuis votre dernière mise à jour. Il faudra peut-être l'habitude d'utiliser la commande update pour visualiser les modifications que vous avez effectuées sur votre copie de travail locale.
[modifier] Paragraphe 6
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
Si vous lancez svn status sans argument à la racine de votre copie de travail, Subversion va détecter toutes les modifications effectuées sur les fichiers et sur l'arborescence. Vous trouverez ci-dessous quelques exemples des lettres-codes que la commande svn status peut afficher. (Notez que le texte après # n'est pas affiché par svn status).
A boulot/pognon/machin.h # le fichier sera ajouté C boulot/pognon/tas.c # le fichier entre en conflit avec une mise à jour D boulot/poisson.c # le fichier sera supprimé (Deletion en anglais) M truc.c # le contenu de truc.c a subi des modifications
- A item
- The file, directory, or symbolic link item has been scheduled for addition into the repository.
- A élément
- Le fichier, répertoire ou lien symbolique "élément" est prévu d'être ajouté au contenu du dépôt.
- 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.
- C élément
- Le fichier "élément" est dans un état de conflit. C'est-à-dire que des modifications ont eu lieu sur le dépôt entre vos dernières mises à jour et ces modifications interfèrent avec les modifications que vous avez effectuées sur votre copie de travail. Vous devez résoudre ce conflit avant de valider vos changements sur le dépôt.
- D item
- The file, directory, or symbolic link item has been scheduled for deletion from the repository.
- D élément
- Le fichier, répertoire ou lien symbolique "élément" est prévu d'être effacé (Deletion en anglais) sur le dépôt.
- M item
- The contents of the file item have been modified.
- M élément
- Le contenu du fichier "élément" a été modifié.
[modifier] Paragraphe 7
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
Si vous spécifiez un chemin à svn status, vous obtenez les informations relatives à ce chemin uniquement :
$ svn status boulot/poisson.c D boulot/poisson.c
[modifier] Paragraphe 8
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
svn status possède aussi une option --verbose (-v) pour le rendre plus verbeux : il affichera alors le statut de tous les éléments dans votre copie de travail, même ceux qui n'ont pas subi de modification :
$ svn status -v
M 44 23 sally LISEZMOI
44 30 sally INSTALL
M 44 20 harry truc.c
44 18 ira boulot
44 35 harry boulot/truite.c
D 44 19 ira boulot/poisson.c
44 21 sally boulot/divers
A 0 ? ? boulot/divers/machin.h
44 36 harry boulot/divers/bidule.c
[modifier] Paragraphe 9
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
Aucune des commandes citées ci-dessus n'induit de connexion vers le dépôt : elles comparent les métadonnées dans le répertoire .svn avec la copie de travail. Enfin, il y a l'option --show-updates (-u) qui effectue une connexion au dépôt et ajoute les informations sur les éléments périmés :
$ svn status -u -v
M * 44 23 sally LISEZMOI
M 44 20 harry truc.c
* 44 35 harry boulot/truite.c
D 44 19 ira boulot/poisson.c
A 0 ? ? boulot/divers/machin.h
Status against revision: 46
[modifier] Paragraphe 10
Another way to examine your changes is with the svn diff command. You can find out exactly how you've modified things by running svn diff with no arguments, which prints out file changes in unified diff format:
$ svn diff
Index: bar.c
===================================================================
--- bar.c (revision 3)
+++ bar.c (working copy)
@@ -1,7 +1,12 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <stdio.h>
int main(void) {
- printf("Sixty-four slices of American Cheese...\n");
+ printf("Sixty-five slices of American Cheese...\n");
return 0;
}
Index: README
===================================================================
--- README (revision 3)
+++ README (working copy)
@@ -193,3 +193,4 @@
+Note to self: pick up laundry.
Index: stuff/fish.c
===================================================================
--- stuff/fish.c (revision 1)
+++ stuff/fish.c (working copy)
-Welcome to the file known as 'fish'.
-Information on fish will be here soon.
Index: stuff/things/bloo.h
==================================================================
--- stuff/things/bloo.h (revision 8)
+++ stuff/things/bloo.h (working copy)
+Here is a new file to describe
+things about bloo.
$ svn diff
Index: truc.c
===================================================================
--- truc.c (revision 3)
+++ truc.c (working copy)
@@ -1,7 +1,12 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <stdio.h>
int main(void) {
- printf("Soixante quatre tranches de fromage...\n");
+ printf("Soixante cinq tranches de fromage...\n");
return 0;
}
Index: LISEZMOI
===================================================================
--- LISEZMOI (revision 3)
+++ LISEZMOI (working copy)
@@ -193,3 +193,4 @@
+Pense-bête : passer au pressing.
Index: boulot/poisson.c
===================================================================
--- boulot/poisson.c (revision 1)
+++ boulot/poisson.c (working copy)
-Bienvenue dans le fichier 'poisson'.
-Plus d'informations seront disponible prochainement.
Index: boulot/divers/machin.h
==================================================================
--- boulot/divers/machin.h (revision 8)
+++ boulot/divers/machin.h (working copy)
+Voici un nouveau fichier pour
+ecrire sur les machins.
[modifier] Paragraphe 11
Output is displayed in unified diff format. That is, removed lines are prefaced with - and added lines are prefaced with +. svn diff also prints filename and offset information useful to the patch program, so you can generate “patches” by redirecting the diff output to a file:
$ svn diff > patchfile
Le format d'affichage est conforme au "diff unifié". C'est-à-dire que les lignes supprimées commencent par le signe '-' et les lignes ajoutées commencent par le signe '+'. svn diff affiche également le nom du fichier et la localisation dans le fichier à l'intention du programme "patch". Vous pouvez ainsi créer des "patches" en redirigeant la sortie de svn diff vers un fichier :
$ svn diff > fichier.patchYou could, for example, email the patch file to another developer for review or testing prior to commit.

