SVNBOOK Chap4 Branching and Merging Advanced Merging Merge Syntax: Full Disclosure
De Framalang Wiki.
Cette page fait partie du projet Version control with subversion.
| Pseudo | Code | Rôle | Statut |
|---|---|---|---|
| Sub Versif | SVF | Traduction | Fait |
| Hotshot92 | Relecture | Fait | |
| Validation |
Sommaire |
Titre
Merge Syntax: Full Disclosure
Syntaxe de merge : pour tout vous dire
Paragraphe 1
You've now seen some examples of the svn merge command, and you're about to see several more. If you're feeling confused about exactly how merging works, you're not alone. Many users (especially those new to version control) are initially perplexed about the proper syntax of the command and about how and when the feature should be used. But fear not, this command is actually much simpler than you think! There's a very easy technique for understanding exactly how svn merge behaves.
Vous venez de voir des exemples de la commande svn merge et vous allez bientôt en voir plusieurs autres. Si la confusion règne dans votre esprit concernant le fonctionnement des fusions, vous n'êtes pas tout seul. De nombreux utilisateurs (en particulier ceux qui découvrent la gestion de versions) sont perplexes au début à propos de la bonne syntaxe de la commande, ainsi que quand et comment utiliser cette fonctionnalité. Mais n'ayez pas peur, cette commande est en fait bien plus simple que vous ne le pensez ! Il y a une technique très simple pour comprendre comment svn merge agit.
Paragraphe 2
The main source of confusion is the name of the command. The term "merge" somehow denotes that branches are combined together, or that some sort of mysterious blending of data is going on. That's not the case. A better name for the command might have been svn diff-and-apply, because that's all that happens: two repository trees are compared, and the differences are applied to a working copy.
La raison principale de la confusion est le nom de la commande. Le terme "merge" indique en quelque sorte que les branches vont être combinées, ou qu'un mystérieux mélange des données va avoir lieu. Ce n'est pas le cas. Un nom plus approprié pour cette commande aurait pu être comparer-et-appliquer, car c'est tout ce qui se passe : deux arborescences sont comparées, et les différences sont appliquées à une copie de travail.
Paragraphe 3
If you're using svn merge to do basic copying of changes between branches, it will generally do the right thing automatically. For example, a command such as the following:
Si vous utilisez svn merge pour effectuer de simples copies de modifications entre branches, il fera généralement ce qu'il faut automatiquement. Par exemple, une commande telle que :
Paragraphe 4
$ svn merge http://svn.example.com/repos/calc/some-branch
$ svn merge http://svn.exemple.com/depot/calc/une-branche
Paragraphe 5
will attempt to duplicate any changes made on some-branch into your current working directory, which is presumably a working copy that shares some historical connection to the branch. The command is smart enough to only duplicate changes that your working copy doesn't yet have. If you repeat this command once a week, it will only duplicate the "newest" branch changes that happened since you last merged.
tentera de dupliquer toutes les modifications faites dans une-branche vers votre répertoire de travail actuel, qui est sans doute une copie de travail partageant des liens historiques avec la branche. La commande est suffisamment intelligente pour ne copier que les modifications que votre copie de travail ne possède pas encore. Si vous répétez cette commande une fois par semaine, elle ne copiera que les modifications "les plus récentes" qui ont eu lieu depuis la dernière fusion.
Paragraphe 6
If you choose to use the svn merge command in all its full glory by giving it specific revision ranges to duplicate, the command takes three main arguments:
1. An initial repository tree (often called the left side of the comparison)
2. A final repository tree (often called the right side of the comparison)
3. A working copy to accept the differences as local changes (often called the target of the merge)
Si vous choisissez d'utiliser la commande svn merge dans sa version intégrale en lui fournissant les groupes de révisions spécifiques à copier, la commande prend trois paramètres :
1. Une arborescence initiale (souvent appelée côté gauche de la comparaison)
2. Une arborescence finale (souvent appelée côté droit de la comparaison)
3. Une copie de travail qui recevra les différences en tant que modifications locales (souvent appelée cible de la fusion)
Paragraphe 7
Once these three arguments are specified, the two trees are compared, and the differences are applied to the target working copy as local modifications. When the command is done, the results are no different than if you had hand-edited the files or run various svn add or svn delete commands yourself. If you like the results, you can commit them. If you don't like the results, you can simply svn revert all of the changes.
Une fois que ces trois paramètres sont fournis, les deux arborescences sont comparées et les différences sont appliquées à la copie de travail cible en tant que modifications locales. Une fois que la commande s'est terminée, le résultat est le même que si vous aviez édité les fichiers à la main ou lancé diverses commandes svn add ou svn delete vous-même. Si le résultat vous plaît, vous pouvez le propager. S'il ne vous plait pas, vous pouvez toujours lancer svn revert pour revenir en arrière sur toutes les modifications.
Paragraphe 8
The syntax of svn merge allows you to specify the three necessary arguments rather flexibly. Here are some examples:
La syntaxe de svn merge vous offre la possibilité de spécifier les trois paramètres de façon assez flexible. Voici quelques exemples :
Paragraphe 9
$ svn merge http://svn.example.com/repos/branch1@150 \ http://svn.example.com/repos/branch2@212 \ my-working-copy $ svn merge -r 100:200 http://svn.example.com/repos/trunk my-working-copy $ svn merge -r 100:200 http://svn.example.com/repos/trunk
$ svn merge http://svn.exemple.com/depot/branche1@150 \ http://svn.exemple.com/depot/branche2@212 \ ma-copie-de-travail $ svn merge -r 100:200 http://svn.exemple.com/depot/trunk ma-copie-de-travail $ svn merge -r 100:200 http://svn.exemple.com/depot/trunk
Paragraphe 10
The first syntax lays out all three arguments explicitly, naming each tree in the form URL@REV and naming the working copy target. The second syntax can be used as a shorthand for situations when you're comparing two different revisions of the same URL. The last syntax shows how the working copy argument is optional; if omitted, it defaults to the current directory.
La première syntaxe liste les trois arguments de façon explicite, spécifiant chaque arborescence sous la forme URL@REV et incluant la copie de travail cible. La deuxième syntaxe peut être utilisée comme raccourci pour les cas où vous comparez des révisions différentes de la même URL. La dernière syntaxe indique que le paramètre copie de travail est optionnel ; s'il est omis, elle utilisera par défaut le répertoire en cours.
Paragraphe 11
While the first example shows the "full" syntax of svn merge, it needs to be used very carefully; it can result in merges which do not record any svn:mergeinfo metadata at all. The next section talks a bit more about this.
Si le premier exemple donne la syntaxe "complète" de svn merge, elle doit être utilisée avec grande prudence ; elle peut en effet aboutir à des fusions qui n'enregistrent pas la moindre méta-donnée svn:mergeinfo. Le paragraphe suivant évoque ceci plus en détail.

