Ramas y Mezclas

casiano@exthost:~/src/subversion$ svn cp svn+ssh://banot/home/casiano/repository/ejemplo/tags/REL-1.0 \
                         svn+ssh://banot/home/casiano/repository/ejemplo/branches/TRY-MGM-cache-pages

casiano@exthost:~/src/subversion$ svn checkout svn+ssh://banot/home/casiano/repository/ejemplo/branches/TRY-MGM-cache-pages
A    TRY-MGM-cache-pages/t
A    TRY-MGM-cache-pages/t/SVN-Example.t
A    TRY-MGM-cache-pages/MANIFEST
A    TRY-MGM-cache-pages/lib
A    TRY-MGM-cache-pages/lib/SVN
A    TRY-MGM-cache-pages/lib/SVN/Example.pm
A    TRY-MGM-cache-pages/Makefile.PL
A    TRY-MGM-cache-pages/Changes
A    TRY-MGM-cache-pages/README
Checked out revision 7.

Ahora, mientras un grupo trabaja en la rama TRY-MGM-cache-pages ...

casiano@exthost:~/src/subversion$ cd TRY-MGM-cache-pages/
casiano@exthost:~/src/subversion/TRY-MGM-cache-pages$ vi lib/SVN/Example.pm
casiano@exthost:~/src/subversion/TRY-MGM-cache-pages$ svn commit -mm
Sending        lib/SVN/Example.pm
Transmitting file data .
Committed revision 8.
casiano@exthost:~/src/subversion/TRY-MGM-cache-pages$ svn diff lib/SVN/Example.pm -r PREV
Index: lib/SVN/Example.pm
===================================================================
--- lib/SVN/Example.pm  (revision 7)
+++ lib/SVN/Example.pm  (working copy)
@@ -28,6 +28,12 @@
 our $VERSION = '0.01';


+sub g1{
+}
+
+sub g2{
+}
+
 # Preloaded methods go here.

 1;

otro trabaja en el tronco ...

casiano@exthost:~/src/subversion$ svn checkout svn+ssh://banot/home/casiano/repository/ejemplo/trunk/ ejemplo
A    ejemplo/t
A    ejemplo/t/SVN-Example.t
A    ejemplo/MANIFEST
A    ejemplo/lib
A    ejemplo/lib/SVN
A    ejemplo/lib/SVN/Example.pm
A    ejemplo/Makefile.PL
A    ejemplo/Changes
A    ejemplo/README
Checked out revision 4.
casiano@exthost:~/src/subversion$ cd ejemplo
casiano@exthost:~/src/subversion/ejemplo$ vi lib/SVN/Example.pm
casiano@exthost:~/src/subversion/ejemplo$ svn commit
Sending        lib/SVN/Example.pm
Transmitting file data .
Committed revision 5.
casiano@exthost:~/src/subversion/ejemplo$ svn diff lib/SVN/Example.pm -r PREV
Index: lib/SVN/Example.pm
===================================================================
--- lib/SVN/Example.pm  (revision 4)
+++ lib/SVN/Example.pm  (working copy)
@@ -30,6 +30,12 @@

 # Preloaded methods go here.

+sub new_functionality1 {
+}
+
+sub new_functionality2 {
+}
+
 1;
 __END__
 # Below is stub documentation for your module. You'd better edit it!

Supongamos que ahora se crea un tag para la release 2.0:

casiano@exthost:~/src/subversion/ejemplo$ svn cp svn+ssh://banot/home/casiano/repository/ejemplo/trunk \
                                          svn+ssh://banot/home/casiano/repository/ejemplo/tags/REL-2.0
Y que queremos mezclar los cambios que se han producido entre las releases 1.0 y 2.0 en la rama RY-MGM-cache-pages:
casiano@exthost:~/src/subversion/TRY-MGM-cache-pages$ svn merge svn+ssh://banot/home/casiano/repository/ejemplo/tags/REL-1.0 \
                                                                svn+ssh://banot/home/casiano/repository/ejemplo/tags/REL-2.0 \
                                                                .
--- Merging differences between repository URLs into '.':
U    lib/SVN/Example.pm
El estatus nos muestra que el fichero lib/SVN/Example.pm ha sido modificado en la copia de trabajo:
casiano@exthost:~/src/subversion/TRY-MGM-cache-pages$ svn status
M       lib/SVN/Example.pm
Veamos cuales son las diferencias:
casiano@exthost:~/src/subversion/TRY-MGM-cache-pages$ svn diff lib/SVN/Example.pm -r BASE
Index: lib/SVN/Example.pm
===================================================================
--- lib/SVN/Example.pm  (revision 8)
+++ lib/SVN/Example.pm  (working copy)
@@ -36,6 +36,15 @@

 # Preloaded methods go here.

+sub new_functionality1 {
+}
+
+sub new_functionality2 {
+}
+
+sub new_functionality3 {
+}
+
 1;
 __END__
 # Below is stub documentation for your module. You'd better edit it!

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.

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.

Casiano Rodríguez León
Licencia de Creative Commons
Principios de Programación Imperativa, Funcional y Orientada a Objetos Una Introducción en Perl/Una Introducción a Perl
por Casiano Rodríguez León is licensed under a Creative Commons Reconocimiento 3.0 Unported License.

Permissions beyond the scope of this license may be available at http://campusvirtual.ull.es/ocw/course/view.php?id=43.
2012-06-19