SVNBOOK Chap4 Branching and Merging Advanced Merging Noticing or Ignoring Ancestry

De Framalang Wiki.

Cette page fait partie du projet Version control with subversion.


Pseudo Code Rôle Statut
Sub Versif SVF Traduction Fait
Hotshot92 1ere Relecture Fait
Validation



Sommaire

Titre

Noticing or Ignoring Ancestry

Prendre en compte ou ignorer l'ascendance

Paragraphe 1

When conversing with a Subversion developer, you might very likely hear reference to the term ancestry. This word is used to describe the relationship between two objects in a repository: if they're related to each other, one object is said to be an ancestor of the other.

Quand vous discutez avec un développeur Subversion, il est très possible qu'il fasse référence au terme d'ascendance. Ce mot est utilisé pour décrire la relation entre deux objets dans un dépôt : s'ils sont liés l'un à l'autre, un des objets est alors qualifié d'ancêtre de l'autre.

Paragraphe 2

For example, suppose you commit revision 100, which includes a change to a file foo.c. Then foo.c@99 is an "ancestor" of foo.c@100. On the other hand, suppose you commit the deletion of foo.c in revision 101, and then add a new file by the same name in revision 102. In this case, foo.c@99 and foo.c@102 may appear to be related (they have the same path), but in fact are completely different objects in the repository. They share no history or "ancestry."

Par exemple, supposons que vous propagiez la révision 100 qui contient une modification d'un fichier truc.c. Dès lors, truc.c@99 est un "ancêtre" de truc.c@100. En revanche, supposons que vous propagiez la suppression de truc.c en révision 101, et ensuite l'ajout d'un nouveau fichier du même nom en révision 102. Dans ce cas, truc.c@99 et truc.c@102 pourraient sembler apparentés (ils ont le même chemin), mais en fait ce sont des objets complètement différents au sein du dépôt. Ils ne partagent aucun historique ou "ascendance".

Paragraphe 3

The reason for bringing this up is to point out an important difference between svn diff and svn merge. The former command ignores ancestry, while the latter command is quite sensitive to it. For example, if you asked svn diff to compare revisions 99 and 102 of foo.c, you would see line-based diffs; the diff command is blindly comparing two paths. But if you asked svn merge to compare the same two objects, it would notice that they're unrelated and first attempt to delete the old file, then add the new file; the output would indicate a deletion followed by an add:

Nous abordons ce point pour mettre en évidence une différence importante entre svn diff et svn merge. La première commande ignore toute ascendance, tandis que la seconde y est particulièrement sensible. Par exemple, si vous demandiez à svn diff de comparer les révisions 99 et 102 de truc.c, vous verriez des différences basées sur les lignes ; la commande diff compare deux chemins à l'aveugle. Mais si vous demandiez à svn merge de comparer les deux mêmes objets, il remarquerait qu'ils ne sont pas liés et essaierait d'abord de supprimer l'ancien fichier, puis d'ajouter le nouveau fichier ; le résultat indiquerait une suppression puis un ajout :

Paragraphe 4

D    foo.c
A    foo.c
D    truc.c
A    truc.c

Paragraphe 5

Most merges involve comparing trees that are ancestrally related to one another; therefore, svn merge defaults to this behavior. Occasionally, however, you may want the merge command to compare two unrelated trees. For example, you may have imported two source-code trees representing different vendor releases of a software project (see the section called "Vendor Branches"). If you ask svn merge to compare the two trees, you'd see the entire first tree being deleted, followed by an add of the entire second tree! In these situations, you'll want svn merge to do a path-based comparison only, ignoring any relations between files and directories. Add the --ignore-ancestry option to your merge command, and it will behave just like svn diff. (And conversely, the --notice-ancestry option will cause svn diff to behave like the svn merge command.)

La plupart des fusions impliquent de comparer des arborescences qui ont une relation d'ascendance de l'une à l'autre ; c'est pourquoi svn merge a ce comportement par défaut. Cependant, à l'occasion, vous pourriez vouloir que la commande svn merge compare deux arborescences sans relation d'ascendance entre elles. Par exemple, vous avez peut-être importé deux arborescences de code source représentant des publications différentes de deux fournisseurs d'un projet logiciel (voir le paragraphe appelé "Branches fournisseur"). Si vous demandiez à svn merge de comparer les deux arborescences, vous verriez la première arborescence complètement supprimée, puis l'ajout de la seconde arborescence toute entière ! Dans ce genre de situations, vous attendez de svn merge qu'il effectue une comparaison basée sur les chemins uniquement, en ignorant toute relation entre les fichiers et les dossiers. Ajoutez l'option --ignore-ancestry à votre commande svn merge et elle se comportera comme svn diff (et inversement, l'option --notice-ancestry fera se comporter svn diff comme la commande svn merge).