Manuals

Ítems externos

A veces es útil construir una copia de trabajo que esté hecha de un número de diferentes obtenciones. Por ejemplo, puede querer que diferentes archivos o carpetas provengan de orígenes distintos de un repositorio, o quizás de repositorios diferentes. Si desea que todos los usuarios tengan la misma estructura, puede definir las propiedades svn:externals para traer el recurso especificado al lugar donde se le necesita.

Carpetas externas

Imaginemos que usted ha obtenido la copia de trabajo de /project1 a D:\dev\project1. Seleccione la carpeta D:\dev\project1, botón derecho y seleccione Menu WindowsPropiedades del menú contextual. Aparecerá el diálogo de propiedades. Vaya a la pestaña de subversion. Alli podrá establecer propiedades. Presione Propiedades.... En el diálogo de propiedades, o bien haga doble clic o svn:externos si ya existe, o presione sobre el botón Nuevo... y seleccione externos del menu. Para agregar un externo nuevo, presione Nuevo... y luego complete la información requerida en el diálogo.

Atención

Los URLs deberán de estar adecuadamente escapados o de lo contrario, no funcionarán, por ejemplo: usted debe de reemplazar cada espacio con %20, tal y como se muestra en el segundo ejemplo anterior.

Si usted desea que la ruta local incluya espacios u cualquier otro caracter especial, puede encerrarlo con comillas dobles, o bién, utilizar el \ símbolo de barras hacia atrás como un caracter de escape al estilo del shell de Unix, precediendo a cualquier caracter especial. Por supuesto que esto significa también que deberá de usar el símbolo / (barra hacia delante) como delimitador de ruta. Este comportamiento es nuevo en Subversión 1.6 y no funcionará en clientes anteriores.

Utilice números globales de revisión

You should strongly consider using explicit revision numbers in all of your externals definitions, as described above. Doing so means that you get to decide when to pull down a different snapshot of external information, and exactly which snapshot to pull. Besides the common sense aspect of not being surprised by changes to third-party repositories that you might not have any control over, using explicit revision numbers also means that as you backdate your working copy to a previous revision, your externals definitions will also revert to the way they looked in that previous revision, which in turn means that the external working copies will be updated to match the way they looked back when your repository was at that previous revision. For software projects, this could be the difference between a successful and a failed build of an older snapshot of your complex code base.

The edit dialog for svn:externals properties allows you to select the externals and automatically set them explicitly to the HEAD revision.

Si el proyecto externo está en el mismo repositorio, cualquier cambio que haga allí se incluirá en la lista de confirmación cuando confirme su proyecto principal.

If the external project is in a different repository, any changes you make to the external project will be shown or indicated when you commit the main project, but you have to commit those external changes separately.

Si utiliza URLs absolutas en las definiciones svn:externals y tiene que relocalizar su copia de trabajo (por ejemplo si la URL de su repositorio cambia), entonces sus externos no cambiarán y puede que no funcionen más.

Para evitar dichos problemas, los clientes de Subversion versión 1.5 y superior soportan URLs externas relativas. Hay cuatro formas para especificar una URL relativa. En los siguientes ejemplos, asumimos que tenemos dos repositorios: uno en http://example.com/svn/repos-1 y otro en http://example.com/svn/repos-2. Tenemos una copia de trabajo de http://example.com/svn/repos-1/project/trunk en C:\Working y la propiedad svn:externals está establecida en trunk.

Relativa a la carpeta padre

These URLs always begin with the string ../ for example:

../../widgets/foo  common/foo-widget
            

This will extract http://example.com/svn/repos-1/widgets/foo into C:\Working\common\foo-widget.

Tenga en cuenta que la URL es relativa a la URL del directorio con la propiedad svn:externals, no al directorio donde la carpeta externa se escribe en el disco.

Relativo a la raíz del repositorio

These URLs always begin with the string ^/ for example:

^/widgets/foo  common/foo-widget
            

This will extract http://example.com/svn/repos-1/widgets/foo into C:\Working\common\foo-widget.

You can easily refer to other repositories with the same SVNParentPath (a common directory holding several repositories). For example:

^/../repos-2/hammers/claw  common/claw-hammer
            

This will extract http://example.com/svn/repos-2/hammers/claw into C:\Working\common\claw-hammer.

Relativa al esquema

URLs beginning with the string // copy only the scheme part of the URL. This is useful when the same hostname must the accessed with different schemes depending upon network location; e.g. clients in the intranet use http:// while external clients use svn+ssh://. For example:

//example.com/svn/repos-1/widgets/foo  common/foo-widget
            

This will extract http://example.com/svn/repos-1/widgets/foo or svn+ssh://example.com/svn/repos-1/widgets/foo depending on which method was used to checkout C:\Working.

Relativa al nombre del servidor

URLs beginning with the string / copy the scheme and the hostname part of the URL, for example:

/svn/repos-1/widgets/foo  common/foo-widget
            

This will extract http://example.com/svn/repos-1/widgets/foo into C:\Working\common\foo-widget. But if you checkout your working copy from another server at svn+ssh://another.mirror.net/svn/repos-1/project1/trunk then the external reference will extract svn+ssh://another.mirror.net/svn/repos-1/widgets/foo.

You can also specify a peg and operative revision for the URL if required. To learn more about peg and operative revisions, please read the corresponding chapter in the Subversion book.

Importante

If you specify the target folder for the external as a subfolder like in the examples above, make sure that all folders in between are versioned as well. So for the examples above, the folder common should be versioned!

While the external will work in most situations properly if folders in between are not versioned, there are some operations that won't work as you expect. And the status overlay icons in explorer will also not show the correct status.

Si necesita más información sobre cómo TortoiseSVN maneja las Propiedades, lea “Configuración del proyecto”.

Para averiguar los diferentes métodos para acceder a subproyectos comunes lea “Incluir un sub-proyecto común”.

Archivos externos

Desde Subversion 1.6 puede añadir un archivo suelo externo a su copia de trabajo utilizando la misma sintaxis que se usa para carpetas. Sin embargo, hay algunas restricciones.

  • The path to the file external must be a direct child of the folder where you set the svn:externals property.

  • La URL de un archivo externo debe estar en el mismo repositorio que la URL donde se insertará el archivo externo; los archivos externos inter-repositorio no están soportados.

Un archivo externo se comporta como cualquier otro archivo versionado en muchos aspectos, pero no pueden ser movidos o eliminados utilizando los comandos normales; en vez de eso, debe modificarse la propiedad svn:externals.

Creando exteriores vía arrastrar y soltar

Si ya tienes una copia funcional de los archivos o directorios que deseas incluir como externos en otra copia funcional, puedes sencillamente añadirlos mediante arrastrar y soltar desde el explorador de Windows.

Simply right drag the file or folder from one working copy to where you want those to be included as externals. A context menu appears when you release the mouse button: SVN Add as externals here if you click on that context menu entry, the svn:externals property is automatically added. All you have to do after that is commit the property changes and update to get those externals properly included in your working copy.

TortoiseSVN homepage