FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 01-24-2011, 11:55 AM
Nico Kadel-Garcia
 
Default unable to check in code to svn when files contain spaces or characters

On Mon, Jan 24, 2011 at 6:57 AM, Agnello George
<agnello.dsouza@gmail.com> 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

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 :
>
> *svn st |grep ? |cut -c8- |sed 's/ / /g' |xargs svn add

Second, stop playing with xargs in command line handling. It is not your friend.

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 ( ) +#@* that svn cannot
> understand as the full path of* 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 '@', '/', 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?
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 01-24-2011, 12:05 PM
Agnello George
 
Default unable to check in code to svn when files contain spaces or characters

On Mon, Jan 24, 2011 at 6:25 PM, Nico Kadel-Garcia <nkadel@gmail.com> wrote:

On Mon, Jan 24, 2011 at 6:57 AM, Agnello George

<agnello.dsouza@gmail.com> 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



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 :

>

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



Second, stop playing with xargs in command line handling. It is not your friend.



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 ( ) +#@* that svn cannot

> understand as the full path of* 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 '@', '/', 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?

_______________________________________________

CentOS mailing list

CentOS@centos.org

http://lists.centos.org/mailman/listinfo/centos


*the reason i need to do this i want to automate the whole process* of checking into to svn* from dev server and checking out to QA server* for testing purpose , my script would change the config file in QA server* .


the developers have lots of issues while checking in .


--
Regards
Agnello D'souza



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 01-24-2011, 12:42 PM
Les Mikesell
 
Default unable to check in code to svn when files contain spaces or characters

On 1/24/11 5:57 AM, 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 ( ) +#@ that svn cannot
> understand as the full path of the file .
>
> can some one help me in this in perl or in shell .

What you need to know is too long to describe here, but first you need to find a
list of shell metacharacters and how to quote them on the command line. Short
version is that a quotes the next character single quotes quote everything
except another single quote literally, double quotes cover most things but allow
$variable expansion.

Then you need to look at what subversion itself requires after you get the
literal value past the shell parser. I thought it was just that @ was
interpreted as file@revision peg revision unless you append another @ to the end
but there could be more restrictions. All of that is simple enough to work
around - but probably not worth it compared to using sensible names. However
the thing that is going to kill you is that files that differ only in case of
one or more letters are different files on linux - and in a linux svn repository
- but not on windows (where such things are most likely being created). Enforce
some rules before that happens.

--
Les Mikesell
lesmikesell@gmail.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 01-24-2011, 12:49 PM
Agnello George
 
Default unable to check in code to svn when files contain spaces or characters

On Mon, Jan 24, 2011 at 7:12 PM, Les Mikesell <lesmikesell@gmail.com> wrote:

On 1/24/11 5:57 AM, 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 ( ) +#@ *that svn cannot

> understand as the full path of *the file .

>

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



What you need to know is too long to describe here, but first you need to find a

list of shell metacharacters and how to quote them on the command line. Short

version is that a quotes the next character single quotes quote everything

except another single quote literally, double quotes cover most things but allow

$variable expansion.



Then you need to look at what subversion itself requires after you get the

literal value past the shell parser. *I thought it was just that @ was

interpreted as file@revision peg revision unless you append another @ to the end

but there could be more restrictions. * All of that is simple enough to work

around - but probably not worth it compared to using sensible names. *However

the thing that is going to kill you is that files that differ only in case of

one or more letters are different files on linux - and in a linux svn repository

- but not on windows (where such things are most likely being created). *Enforce

some rules before that happens.



--

* Les Mikesell

* *lesmikesell@gmail.com




I found the solution ( i think )
i did

*svn add* html/Set min account.htmlsvn: warning: 'html/Set' not found
svn: warning: 'min' not found

svn: warning: 'account.html' not found


then i did
svn add* "html/Set min account.html"
A******** html/Set min account.html


so here is my final answer

instead of doing


for i in $(svn st | grep "?" | awk '{print $2}'); do svn add $i;done

i can do

for i in $(svn st | grep "?" | awk '{print $2}'); do svn add "$i" ;done


This is working for me ... i wonder if i am going to stumble somewhere ...humm!

--
Regards
Agnello D'souza



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 01-24-2011, 12:58 PM
Les Mikesell
 
Default unable to check in code to svn when files contain spaces or characters

On 1/24/11 7:49 AM, Agnello George wrote:
>
> so here is my final answer
>
> instead of doing
>
> for i in $(svn st | grep "?" | awk '{print $2}'); do svn add $i;done
>
> i can do
>
> for i in $(svn st | grep "?" | awk '{print $2}'); do svn add *"$i" *;done
>
> This is working for me ... i wonder if i am going to stumble somewhere ...humm!

Yes, I'm not sure if that would work at the shell level if the files have
embedded $'s and you are still going to miss on files with embedded @'s. And
I'll repeat that as soon as someone duplicates one of those mixed case filenames
with a case difference you won't be able to check out both copies on windows.

--
Les Mikesell
lesmikesell@gmail.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 01-24-2011, 01:56 PM
 
Default unable to check in code to svn when files contain spaces or characters

Agnello George wrote:
> On Mon, Jan 24, 2011 at 6:25 PM, Nico Kadel-Garcia <nkadel@gmail.com>
> wrote:
<snip>
>> On Mon, Jan 24, 2011 at 6:57 AM, Agnello George
>> <agnello.dsouza@gmail.com> wrote:
>>
>> Can you first explain why you want, or need, to do this?
>
> the reason i need to do this i want to automate the whole process of
> checking into to svn from dev server and checking out to QA server for
> testing purpose , my script would change the config file in QA server .
>
> the developers have lots of issues while checking in .

First, why not one svn server? All vcs's have tags or labels or whatever
they call them, and you extract by label <test> instead of <dev>, or
<head>, or whatever.

Second, the issues that the developers have while checking in needs to be
addressed, including management calling them into a meeting and telling
them YOU WILL CHECK THE DAMN THINGS IN!!!!

mark, who has been in charge of software configuration management
at more than one job

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 01-24-2011, 02:49 PM
Les Mikesell
 
Default unable to check in code to svn when files contain spaces or characters

On 1/24/2011 7:05 AM, Agnello George wrote:
>
> the reason i need to do this i want to automate the whole process of
> checking into to svn from dev server and checking out to QA server for
> testing purpose , my script would change the config file in QA server .
>
> the developers have lots of issues while checking in .

Are the developers generating those .xls files running windows? If so,
get them to install tortoise svn which makes subversion operations a
right-mouse away. And by the way, you are going to run into even more
problems if they are saving to a samba share and you check in from
there. Subversion's concept of 'native' eol depends on the OS where the
file is created being the same as the one running the svn client.

--
Les Mikesell
lesmikesell@gmail.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 01-26-2011, 03:21 AM
Nico Kadel-Garcia
 
Default unable to check in code to svn when files contain spaces or characters

On Mon, Jan 24, 2011 at 9:06 AM, <cpolish@surewest.net> wrote:
> Nico Kadel-Garcia wrote:

>> > i as able to add other files with space using the following command :
>> >
>> > *svn st |grep ? |cut -c8- |sed 's/ / /g' |xargs svn add
>>
>> Second, stop playing with xargs in command line handling. It is not your friend.
>
> That seems harsh. Can you explain? It's been my experience
> that using "find mumble/ -print0 | xargs -0 mumble" almost
> always provides a way to process arbitrary file names. But
> maybe this particular case can't be shoehorned into that
> idiom?

It's a bit harsh, The fact that this conversation is happening here,
instead of the subversion user list where it would be more
appropriate, is a bit problematic. I personally hang out on both, but
you'll get better application advice like this on the appropriate user
mailing list.

xargs is very useful, but for line-by-line processing like this, its
default mangling of whitespace is designed to pass the set of
arguments as command line arguments to some basic shell command like
"rm" or "cp" or "cat". Read the manual page for details, or run "info
xargs" to get the full texinfo documentation.

If you *NEED* to do this, you can use something like:

svn st |grep ^'?' |cut -c8- | xargs --null svn add

This helps avoid border cases with spaces or tabs or '?' in filenames.
Robustly sanitizing inputs is an art form.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 02:34 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org