SVNBOOK Chap4 Branching and Merging Using Branches Working with Your Branch

De Framalang Wiki.

Cette page fait partie du projet Version control with subversion.


Pseudo Code Rôle Statut
Sub Versif SVF Traduction Terminé
Hotshot92 Relecture Terminé
Validation


Sommaire

Titre

Working with Your Branch
Travailler avec votre branche

Paragraphe 1

Now that you've created a branch of the project, you can check out a new working copy to start using it:

$ svn checkout http://svn.example.com/repos/calc/branches/my-calc-branch
A  my-calc-branch/Makefile
A  my-calc-branch/integer.c
A  my-calc-branch/button.c
Checked out revision 341.
Maintenant que vous avez créé votre branche du projet, vous pouvez extraire une nouvelle copie de travail pour commencer à l'utiliser :
$ svn checkout http://svn.exemple.com/depot/calc/branches/ma-branche-calc
A  ma-branche-calc/Makefile
A  ma-branche-calc/entier.c
A  ma-branche-calc/bouton.c
Révision 341 extraite.


Paragraphe 2

There's nothing special about this working copy; it simply mirrors a different directory in the repository. When you commit changes, however, Sally won't see them when she updates, because her working copy is of /calc/trunk. (Be sure to read the section called "Traversing Branches" later in this chapter: the svn switch command is an alternative way of creating a working copy of a branch.)
Cette copie de travail n'a rien de spéciale ; elle correspond juste à un dossier différent du dépôt. Cependant, quand vous livrerez vos modifications, Sally ne les verra pas quand elle fera la mise à jour, car sa copie de travail correspond à calc/trunk (Pensez bien à lire la section "Parcourir les branches" plus loin dans ce chapitre : la commande svn switch est une façon alternative de créer une copie de travail d'une branche).

Paragraphe 3

Let's pretend that a week goes by, and the following commits happen:

* You make a change to /calc/branches/my-calc-branch/button.c, which creates revision 342.
* You make a change to /calc/branches/my-calc-branch/integer.c, which creates revision 343.
* Sally makes a change to /calc/trunk/integer.c, which creates revision 344.

Now two independent lines of development (shown in Figure 4.4, "The branching of one file's history") are happening on integer.c.

Imaginons qu'une semaine se passe, et que les livraisons suivantes ont lieu:

* Vous modifiez /calc/branches/ma-branche-calc/bouton.c, ce qui crée la révision 342.
* Vous modifiez /calc/branches/ma-branche-calc/entier.c, ce qui crée la révision 343.
* Sally modifie /calc/trunk/entier.c, ce qui crée la révision 344.
A présent, deux lignes de développement indépendantes (voir la Figure 4.4, "Historique des branches d'un fichier") existent pour entier.c.

Paragraphe 4

Things get interesting when you look at the history of changes made to your copy of integer.c:

 $ pwd
 /home/user/my-calc-branch
 
 $ svn log -v integer.c
 ------------------------------------------------------------------------
 r343 | user | 2002-11-07 15:27:56 -0600 (Thu, 07 Nov 2002) | 2 lines
 Changed paths:
    M /calc/branches/my-calc-branch/integer.c
 
 * integer.c:  frozzled the wazjub.
 
 ------------------------------------------------------------------------
 r341 | user | 2002-11-03 15:27:56 -0600 (Thu, 07 Nov 2002) | 2 lines
 Changed paths:
    A /calc/branches/my-calc-branch (from /calc/trunk:340)
 
 Creating a private branch of /calc/trunk.
 
 ------------------------------------------------------------------------
 r303 | sally | 2002-10-29 21:14:35 -0600 (Tue, 29 Oct 2002) | 2 lines
 Changed paths:
    M /calc/trunk/integer.c
 
 * integer.c:  changed a docstring.
 
 ------------------------------------------------------------------------
 r98 | sally | 2002-02-22 15:35:29 -0600 (Fri, 22 Feb 2002) | 2 lines
 Changed paths:
   A /calc/trunk/integer.c

* integer.c:  adding this file to the project.

------------------------------------------------------------------------

Les choses deviennent intéressantes quand vous regardez l'historique des modifications apportées à votre copie de entier.c :

 $ pwd
 /home/utilisateur/ma-branche-calc
 
 $ svn log -v entier.c
 ------------------------------------------------------------------------
 r343 | utilisateur | 2002-11-07 15:27:56 -0600 (jeu. 07 nov. 2002) | 2 lines
 Chemins modifiés :
    M /calc/branches/ma-branche-calc/entier.c
 
 * entier.c:  machiné le bidule.
 
 ------------------------------------------------------------------------
 r341 | utilisateur | 2002-11-03 15:27:56 -0600 (jeu. 07 nov. 2002) | 2 lines
 Chemins modifiés :
    A /calc/branches/ma-branche-calc (from /calc/trunk:340)
 
 Création d'une branche privée à partir de /calc/trunk.
 
 ------------------------------------------------------------------------
 r303 | sally | 2002-10-29 21:14:35 -0600 (mar. 29 oct. 2002) | 2 lines
 Chemins modifiés :
    M /calc/trunk/entier.c
 
 * entier.c:  modifié une docstring.
 
 ------------------------------------------------------------------------
 r98 | sally | 2002-02-22 15:35:29 -0600 (ven. 22 fev. 2002) | 2 lines
 Chemins modifiés :
   A /calc/trunk/entier.c

* entier.c:  ajout du fichier dans ce projet.

------------------------------------------------------------------------

Paragraphe 5

Notice that Subversion is tracing the history of your branch's integer.c all the way back through time, even traversing the point where it was copied. It shows the creation of the branch as an event in the history, because integer.c was implicitly copied when all of /calc/trunk/ was copied. Now look at what happens when Sally runs the same command on her copy of the file:

$ pwd
/home/sally/calc

$ svn log -v integer.c
------------------------------------------------------------------------
r344 | sally | 2002-11-07 15:27:56 -0600 (Thu, 07 Nov 2002) | 2 lines
 Changed paths:
    M /calc/trunk/integer.c
 
 * integer.c:  fix a bunch of spelling errors.
 
 ------------------------------------------------------------------------
 r303 | sally | 2002-10-29 21:14:35 -0600 (Tue, 29 Oct 2002) | 2 lines
 Changed paths:
    M /calc/trunk/integer.c
 
 * integer.c:  changed a docstring.
 
 ------------------------------------------------------------------------
 r98 | sally | 2002-02-22 15:35:29 -0600 (Fri, 22 Feb 2002) | 2 lines
 Changed paths:
   A /calc/trunk/integer.c

* integer.c:  adding this file to the project.

------------------------------------------------------------------------

Notez bien que Subversion reprend tout l'historique du entier.c de votre branche à travers le temps, remontant même jusqu'au point où il a été copié. Il liste la création d'une branche en tant qu'élément de l'historique, parce qu'entier.c a été copié implicitement lorsque calc/trunk tout entier a été copié. Maintenant regardez ce qui se passe quand Sally lance la même commande sur sa copie du fichier :

$ pwd
/home/sally/calc

$ svn log -v entier.c
------------------------------------------------------------------------
r344 | sally | 2002-11-07 15:27:56 -0600 (jeu. 07 nov. 2002) | 2 lines
 Chemins modifiés :
    M /calc/trunk/entier.c
 
 * entier.c:  corrigé un ensemble de coquilles.
 
 ------------------------------------------------------------------------
 r303 | sally | 2002-10-29 21:14:35 -0600 (mar. 29 oct. 2002) | 2 lines
 Chemins modifiés :
    M /calc/trunk/entier.c
 
 * entier.c:  modifié une docstring.
 
 ------------------------------------------------------------------------
 r98 | sally | 2002-02-22 15:35:29 -0600 (ven. 22 fev. 2002) | 2 lines
 Chemins modifiés :
   A /calc/trunk/entier.c

* entier.c:  ajout du fichier dans ce projet.

------------------------------------------------------------------------

Paragraphe 6

Sally sees her own revision 344 change, but not the change you made in revision 343. As far as Subversion is concerned, these two commits affected different files in different repository locations. However, Subversion does show that the two files share a common history. Before the branch copy was made in revision 341, the files used to be the same file. That's why you and Sally both see the changes made in revisions 303 and 98.
Sally voit la modification due à sa propre révision 344, mais pas le changement que vous avez effectué dans la révision 343. Pour Subversion, ces deux propagations ont touché des fichiers différents dans des dossiers distincts. Néanmoins, Subversion indique que les deux fichiers partagent une histoire commune. Avant que la copie de branche n'ait été faite en révision 341, les fichiers ne faisaient qu'un. C'est pourquoi Sally et vous voyez tous les deux les modifications apportées en révisions 303 et 98.