SVNBOOK Chap2 Examining History Examining the details of historical changes
De Framalang Wiki.
Cette page fait partie du projet Version control with subversion.
| Pseudo | Code | Rôle | Statut |
|---|---|---|---|
| Hotshot92 | Traduction | Fait | |
| SVF | Mise à jour en dernière version 1.5 | Fait | |
| SVF | 1ère Relecture | Fait | |
| Retranscription des sorties des exemples en français | A faire | ||
| Validation |
Sommaire |
Examining the Details of Historical Changes
Examining the Details of Historical Changes
We've already seen svn diff before—it displays file differences in unified diff format; we used it to show the local modifications made to our working copy before committing to the repository.
In fact, it turns out that there are three distinct uses of svn diff:
- Examining local changes
- Comparing your working copy to the repository
- Comparing repository revisions
Nous avons déjà vu la commande svn diff, qui affiche les différences entre fichiers au format diff unifié ; nous l'avons utilisé pour afficher les modifications locales effectuées sur notre copie de travail avant de les propager vers le dépôt.
En fait, il y a trois façons différentes d'utiliser svn diff :
- Examiner des modifications locales
- Comparer votre copie de travail au dépôt
- Comparer des révisions du dépôt
Examining local changes
Examining local changes
Examiner des modifications locales
As we've seen, invoking svn diff with no options will compare your working files to the cached “pristine” copies in the .svn area:
$ svn diff Index: rules.txt =================================================================== --- rules.txt (revision 3) +++ rules.txt (working copy) @@ -1,4 +1,5 @@ Be kind to others Freedom = Responsibility Everything in moderation -Chew with your mouth open +Chew with your mouth closed +Listen when others are speaking $
Comme nous l'avons vu précédemment, invoquer svn diff sans option compare les fichiers de votre copie de travail à leur versions "originales" gardées en cache dans la zone .svn :
$ svn diff
Index: regles.txt
===================================================================
--- regles.txt (revision 3)
+++ regles.txt (working copy)
@@ -1,4 +1,5 @@
Être attentif envers les autres
Liberté = Responsabilité
Tout dans la modération
-Mâcher la bouche ouverte
+Mâcher la bouche fermée
+Écouter quand les autres parlent
$
Comparing working copy to repository
Comparing working copy to repository
Comparer une copie de travail au dépôt
If a single --revision (-r) number is passed, your working copy is compared to the specified revision in the repository:
$ svn diff -r 3 rules.txt Index: rules.txt =================================================================== --- rules.txt (revision 3) +++ rules.txt (working copy) @@ -1,4 +1,5 @@ Be kind to others Freedom = Responsibility Everything in moderation -Chew with your mouth open +Chew with your mouth closed +Listen when others are speaking $
Si un seul numéro de révision est fourni à l'option --revision (-r), votre copie de travail est comparée à la révision spécifiée du dépôt :
$ svn diff -r 3 regles.txt Index: regles.txt =================================================================== --- regles.txt (revision 3) +++ regles.txt (working copy) @@ -1,4 +1,5 @@ Être attentif envers les autres Liberté = Responsabilité Tout dans la modération -Mâcher la bouche ouverte +Mâcher la bouche fermée +Écouter quand les autres parlent $
Comparing repository revisions
Comparing repository revisions
Comparer des révisions du dépôt
If two revision numbers, separated by a colon, are passed via --revision (-r), the two revisions are directly compared:
$ svn diff -r 2:3 rules.txt Index: rules.txt =================================================================== --- rules.txt (revision 2) +++ rules.txt (revision 3) @@ -1,4 +1,4 @@ Be kind to others -Freedom = Chocolate Ice Cream +Freedom = Responsibility Everything in moderation Chew with your mouth open $
Si deux numéros de révision sont fournis à l'option --revision (-r), séparés par le caractère deux points (:), les deux révisions sont directement comparées :
$ svn diff -r 2:3 regles.txt Index: regles.txt =================================================================== --- regles.txt (revision 2) +++ regles.txt (revision 3) @@ -1,4 +1,4 @@ Être attentif envers les autres -Liberté = Glace Au Chocolat +Liberté = Responsabilité Tout dans la modération Mâcher la bouche ouverte $
A more convenient way of comparing one revision to the previous revision is to use the --change (-c) option:
$ svn diff -c 3 rules.txt Index: rules.txt =================================================================== --- rules.txt (revision 2) +++ rules.txt (revision 3) @@ -1,4 +1,4 @@ Be kind to others -Freedom = Chocolate Ice Cream +Freedom = Responsibility Everything in moderation Chew with your mouth open $
Lastly, you can compare repository revisions even when you don't have a working copy on your local machine, just by including the appropriate URL on the command line:
$ svn diff -c 5 http://svn.example.com/repos/example/trunk/text/rules.txt … $
Une autre façon de comparer une révision à la précédente, plus conviviale, est d'utiliser l'option --change (-c) :
$ svn diff -c 3 regles.txt Index: regles.txt =================================================================== --- regles.txt (revision 2) +++ regles.txt (revision 3) @@ -1,4 +1,4 @@ Être attentif envers les autres -Liberté = Glace Au Chocolat +Liberté = Responsabilité Tout dans la modération Mâcher la bouche ouverte $
Enfin, vous pouvez comparer des révisions du dépôt même si vous n'avez pas de copie de travail en local sur votre ordinateur, simplement en incluant l'URL appropriée sur la ligne de commande :
$ svn diff -c 5 http://svn.exemple.com/depot/exemple/trunk/texte/regles.txt … $

