¿Cómo escapar @ caracteres en los nombres de archivo administrados por Subversion?


Para muchas operaciones de Subversion, añadir el símbolo '@' al final de un archivo o argumento URL le permite apuntar a una revisión específica de ese archivo. Por ejemplo, "svn info test.txt@1234 " dará información sobre la prueba.txt tal como existía en la revisión 1234.

Sin embargo, cuando el nombre del archivo contiene una@, Subversion lo interpreta incorrectamente como un especificador de revisión:

Svn info '[email protected]" svn: Revisión de análisis de error de sintaxis '.txt "

He intentado comillas dobles y simples, así como escapar con'/', ' \ ' y '@'. ¿Cómo puedo decirle a Subversion que trate los símbolos @ como parte del nombre del archivo?

 184
Author: weston, 2009-04-16

11 answers

Del libro SVN (énfasis añadido):

El lector perceptivo probablemente se esté preguntando en este punto si la sintaxis de revisión de peg causa problemas para las rutas de copia de trabajo o las URL que realmente tienen signos at en ellas. Después de todo, ¿cómo sabe svn si news@11 es el nombre de un directorio en mi árbol o simplemente una sintaxis para "revisión 11 de noticias"? Afortunadamente, mientras que svn siempre asumirá lo último, hay una solución trivial. Usted solo es necesario añadir un signo at al final de la ruta, como news@11@. svn solo se preocupa por el último signo at en el argumento, y no se considera ilegal omitir un especificador de revisión de peg literal después de ese signo at. Esta solución se aplica incluso a las rutas que terminan en un signo at: usaría filename@@ para hablar de un archivo llamado filename@.

 268
Author: Rob Kennedy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-04-16 18:42:42

La respuesta original es correcta, pero quizás no lo suficientemente explícita. Las opciones particulares de la línea de comandos de unix son las siguientes:

svn info '[email protected]@'

O

svn info "[email protected]@"

O

svn info image\@2x.png\@

Acabo de probar los tres.

 82
Author: David H,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-02-22 22:52:35

Solución para agregar varios archivos en diferentes subcarpetas:

for file in $(find ./ -type f -name "*@*.png"); do svn add $file@; done

Simplemente reemplace el " png " en "@.png " al tipo de archivos que desea agregar.

 14
Author: Lcsky,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-09-06 03:17:47

Para agregar el siguiente archivo : [email protected] haga lo siguiente: svn añadir image\@2x.png@

 11
Author: Malek Belkahla,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-12-16 16:26:00

En mi caso, necesitaba eliminar archivos de un repositorio SVN que contenía un signo@:

Esto no funcionaría:

svn remove 'src/assets/images/hi_res/[email protected]'

Pero esto lo hizo:

svn remove 'src/assets/images/hi_res/[email protected]@'
 8
Author: NPike,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-09-22 23:37:47

Para agregar varios archivos, hay una solución alternativa:

svn status | grep \.png | awk '{print $2"@"}'| xargs svn add
 5
Author: liruqi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-23 09:45:29

Simplemente agregue

@

En el archivo que necesita usar, no importa qué comando SVN sea, por ejemplo:

[email protected]

A

[email protected]@
 5
Author: Alejandro Pablo Tkachuk,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-25 20:17:47

Para comandos svn con 2 argumentos como "move", debe agregar "@" solo en el parámetro izquierdo (primer). Por ejemplo:

$ svn add README@txt@
A         README@txt

$ svn move README@txt@ README2@txt
A         README2@txt
D         README@txt


$ svn status
A       README2@txt

$ svn commit -m "blah"
Adding         README2@txt
Transmitting file data .
Committed revision 168.

$ svn delete README2@txt@
D         README2@txt

$ svn commit -m "blahblah"
*Deleting       README2@txt

Committed revision 169.

Esta línea es importante: sv svn move README@txt@ README2@txt

Como puede ver, no necesitamos agregar "@" en "README2@txt"

 1
Author: Srdjan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-02-20 10:44:28

@David H

Acabo de probar un comando similar sin escapar de los símbolos @ y todavía funciona bien

svn ci splash.png [email protected]@

Esto es en GNU bash, versión 3.2.48 (1)-release (x86_64-apple-darwin10.0) y svn 1.6.16

 0
Author: Qazzian,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-08-26 09:22:39

La única solución que funcionó para mí fue la misma sugerida por @NPike

Svn revert ' path/to / filename@ext@'

 0
Author: Jonyx4,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-05 13:52:09

Hoy tuve el problema con los nombres de archivo generados a partir de direcciones de correo electrónico (¡no es una muy buena idea!).

Solución, usando printf opciones de find, y expansión de shell

 svn add  $(find . -name "*@*.png" -printf "%p@ ")
 0
Author: Michel Billaud,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-04-19 10:32:49