unable to check in code to svn when files contain spaces

--===============2115482789==
Content-Type: multipart/alternative; boundary=000e0cd762a8d4f388049a964c39

--000e0cd762a8d4f388049a964c39
Content-Type: text/plain; charset=ISO-8859-1

i got a file like this and i need add it into my svn

admin/upload_data/FINAL leg list 19_01_2010 to agar (Merged data in
one).xls

i as able to add other files with space using the following command :

svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add

however there are some special characters like ( ) +# [at] that svn cannot
understand as the full path of the file .

can some one help me in this in perl or in shell .

--
Regards
Agnello D'souza

--000e0cd762a8d4f388049a964c39
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

i got a file like this and i need add it into my svn <br><br>admin/upload_d=
ata/FINAL=A0 leg=A0 list=A0 19_01_2010 to=A0 agar=A0 (Merged data in one).x=
ls<br><br>i as able to add other files with space using the following comma=
nd : <br>
<br>=A0svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add <br=
><br>however there are some special characters like ( ) +# [at] =A0 that svn can=
not understand as the full path of=A0 the file . <br><br>can some one help =
me in this in perl or in shell . <br clear=3D"all">
<br>-- <br>Regards <br>Agnello D'souza<br><br><br>

--000e0cd762a8d4f388049a964c39--

--===============2115482789==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
CentOS mailing list
CentOS-IFYaIzF+flcdnm+yROfE0A [at] public.gmane.org
http://lists.centos.org/mailman/listinfo/centos

--===============2115482789==--
Agnello George [ Mo, 24 Januar 2011 12:57 ] [ ID #2053754 ]

Re: unable to check in code to svn when files containspaces or characters

On Mon, Jan 24, 2011 at 6:57 AM, Agnello George
<agnello.dsouza-Re5JQEeQqe8AvxtiuMwx3w [at] public.gmane.org> wrote:
> i got a file like this and i need add it into my svn
>
> admin/upload_data/FINAL=A0 leg=A0 list=A0 19_01_2010 to=A0 agar=A0 (Merge=
d data in
> one).xls

First: don't do this, seriously. You're begging for pain in your
scripting to handle such files from now on.


> i as able to add other files with space using the following command :
>
> =A0svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add

Second, stop playing with xargs in command line handling. It is not your fr=
iend.

You should be able to do "svn add "admin/upload_data/FINAL leg list

svn add "admin/upload_data/FINAL leg list 19_01_2010 to agar
(Merged data in one).xls"

> however there are some special characters like ( ) +# [at] =A0 that svn cannot
> understand as the full path of=A0 the file .

Well, *YES*. You're going to have difficulty getting characters that
mean things to the subversion somponent numbering scheme or the
Subversion URL scheme, such as ' [at] ', '/', and '#' into the actual
filenames. Even if you can leverage your way past this by stuffing in
enough backslashes, you're effectively destabilizing your Subversion
repository and scripting to handle it, especially post-commit scripts.

> can some one help me in this in perl or in shell .
>
> --
> Regards
> Agnello D'souza

Can you first explain why you want, or need, to do this?
Nico Kadel-Garcia [ Mo, 24 Januar 2011 13:55 ] [ ID #2053755 ]

Re: unable to check in code to svn when files contain spaces or characters

On Monday 24 Jan 2011 13:57:11 Agnello George wrote:
> i got a file like this and i need add it into my svn
>
> admin/upload_data/FINAL leg list 19_01_2010 to agar (Merged data in
> one).xls
>
> i as able to add other files with space using the following command :
>
> svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add
>
> however there are some special characters like ( ) +# [at] that svn cannot
> understand as the full path of the file .
>
> can some one help me in this in perl or in shell .

1. I suggest you try using Subversion's SVN::Wc API:

http://search.cpan.org/perldoc?SVN::Wc

It is written in C and has bindings for Perl and other languages, and it more
reliabale than parsing the command line.

2. If that fails you can try this:

[code]

#!/usr/bin/perl

use strict;
use warnings;

open my $svn_st, "svn st|";

my [at] files_to_add;

while (my $line = <$svn_st>)
{
chomp($line);

if ($line =~ m{\A\?})
{
push [at] files_to_add, substr($line,8);
}
}
close($svn_st);

system("svn", "add", [at] files_to_add);

[/code]

Note that I've used the list form of perldoc -f system.

Regards,

Shlomi Fish
--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Apple Inc. is Evil - http://www.shlomifish.org/open-source/anti/apple/

Chuck Norris can make the statement "This statement is false" a true one.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shlomi Fish [ Mo, 24 Januar 2011 16:19 ] [ ID #2053757 ]

Re: [linux] unable to check in code to svn when files contain

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Jan 24, 2011 at 05:27:11PM +0530, Agnello George wrote:
> i got a file like this and i need add it into my svn
>
> admin/upload_data/FINAL leg list 19_01_2010 to agar (Merged data in
> one).xls
>
> i as able to add other files with space using the following command :
>
> svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add
>
> however there are some special characters like ( ) +# [at] that svn cannot
> understand as the full path of the file .
>
> can some one help me in this in perl or in shell .

If in perl, then you may want to pass the arguments to the system
command as an array, so:

[at] arg = [ "svn", "add", "File with spaces" ];
system( [at] arg );

Hope this helps

- --
Best regards,
Ed http://www.s5h.net/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAk09300ACgkQ4dyr7s6PRYil6wCfc9p+peQ3pUyiAMCHDrS/ XeGI
QN4AoJdHUjWPLWngvO7yefCqzVXcMAHn
=g9Zc
-----END PGP SIGNATURE-----

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Ed [ Mo, 24 Januar 2011 21:21 ] [ ID #2053815 ]

Re: [linux] unable to check in code to svn when files contain spaces or characters

On Monday 24 Jan 2011 22:21:33 ed wrote:
> On Mon, Jan 24, 2011 at 05:27:11PM +0530, Agnello George wrote:
> > i got a file like this and i need add it into my svn
> >
> > admin/upload_data/FINAL leg list 19_01_2010 to agar (Merged data in
> > one).xls
> >
> > i as able to add other files with space using the following command :
> > svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add
> >
> > however there are some special characters like ( ) +# [at] that svn cannot
> > understand as the full path of the file .
> >
> > can some one help me in this in perl or in shell .
>
> If in perl, then you may want to pass the arguments to the system
> command as an array, so:
>
> [at] arg = [ "svn", "add", "File with spaces" ];
> system( [at] arg );

1. [...] is an anonymous array reference. In ordere to initialise arrays you
want ( ... ).

2. You should declare [at] arg (preferably called [at] args) using my:

my [at] args = ("svn", "add", "File with spaces");

Regards,

Shlomi Fish

--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Parody of "The Fountainhead" - http://shlom.in/towtf

Chuck Norris can make the statement "This statement is false" a true one.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shlomi Fish [ Di, 25 Januar 2011 09:05 ] [ ID #2053817 ]

Re: [linux] unable to check in code to svn when files contain

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Jan 24, 2011 at 08:21:33PM +0000, ed wrote:
....
> [at] arg = [ "svn", "add", "File with spaces" ];

My bad... as pointed out by Shlomi Fish, this is incorrect and should
instead be:

[at] arg = ( "svn", "add", "File with spaces" );

- --
Best regards,
Ed http://www.s5h.net/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAk0/Bi0ACgkQ4dyr7s6PRYhtvgCdFLPPeygSKx2MzQ/IsIuZ CMfZ
FdkAmwfomulsPRD5O38Ou0TSzSX5YyRm
=je1o
-----END PGP SIGNATURE-----

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Ed [ Di, 25 Januar 2011 18:19 ] [ ID #2053881 ]
Perl » gmane.comp.lang.perl.beginners » unable to check in code to svn when files contain spaces

Vorheriges Thema: wiki CMS
Nächstes Thema: Need Help with Perl Mobile Environment