You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Kota, Sreenivasa ShravanaKumar" <sh...@hp.com> on 2008/03/14 09:43:26 UTC

Subversion and samba

Hi All,

I have a subversion working copy in unix. I have configured samba on my unix box so that I can access the working copy from windows.

I have modified files in windows and commit them using TortoiseSVN on windows.

When I check / open the files in unix, I see that there are control-M characters in each file that I committed from windows.

Is there any configuration / settings available in subversion or Tortoise SVN which will avoid adding control characters when files modified and committed from windows.

Also, I don't see the TortoiseSVN Icons on the samba shared working copy in windows.

I appreciate your help


Thanks & Regards,
Shravana Kumar





Re: Subversion and samba

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 14, 2008, at 16:53, Scott Sharkey wrote:

> Ryan Schmidt wrote:
>> On Mar 14, 2008, at 12:54, Scott Sharkey wrote:
>>> Paul Koning wrote:
>>>>>>>>> "Edward" == Edward Harvey <Harvey> writes:
>>>>  Edward> The ^M characters aren't added by svn, they're added by  
>>>> your
>>>>  Edward> text editor.  Cross-platform editors such as vi, gvim,  
>>>> emacs,
>>>>  Edward> and xemacs won't do that.  You can convert the file  
>>>> formats
>>>>  Edward> with "dos2unix" and "unix2dos"
>>>>  Edward> I never would have guessed, but in the other replies so  
>>>> far,
>>>>  Edward> they say you can also have svn (or tortoise)  
>>>> automatically do
>>>>  Edward> the unix2dos or dos2unix for you.  Essentially yes.   
>>>> Take a look at svn:eol-style.  As a rule of thumb,
>>>> this attribute should always be set (usually to "native") for  
>>>> any text
>>>> file.
>>>> Values other than "native" are sometimes useful.  For example,  
>>>> we have
>>>> a nightly build machinery setup where a working directory is  
>>>> checked
>>>> out on a Unix system, then copied or net-mounted from a Windows  
>>>> system
>>>> that has to build some of the bits.  The source files can be  
>>>> "native",
>>>> because the Windows compilers accept Unix line endings in the
>>>> sources.  But control files, like the "project" files, need Windows
>>>> line endings.  So we set eol-style to CRLF for those.
>>>
>>> Paul: is there a way to make "native" the "default", or do we  
>>> literally
>>> need to enforce it on every file when checked in?
>>
>> What you do is this:
>>
>> On every client, edit the Subversion config file and set up your  
>> auto-props to automatically set this property to the desired value  
>> on all files where that would be appropriate.
>>
>> Then, on the server site, write a pre-commit hook to reject  
>> commits that do not match your policy.
>
> I was afraid you were gonna say that...  Well, I guess I appreciate  
> it.
>
> Unfortunately, that means I will end up doing a LOT of developer  
> education, but I guess that's the price we pay.  I wonder if I can  
> develop a pre-commit hook to auto-set that property?

You can't modify the incoming transaction in the pre-commit hook. You  
can only accept or reject it.

Build your developer education into the hook script. If you're going  
to reject the commit, print a detailed message on stderr explaining  
why the commit is being rejected and how the developer can set up  
their environment to prevent this error in the future.

Don't forget to Reply All so your replies go to the list too, not  
just to me.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Subversion and samba

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 14, 2008, at 12:54, Scott Sharkey wrote:

> Paul Koning wrote:
>>>>>>> "Edward" == Edward Harvey <Harvey> writes:
>>  Edward> The ^M characters aren't added by svn, they're added by your
>>  Edward> text editor.  Cross-platform editors such as vi, gvim,  
>> emacs,
>>  Edward> and xemacs won't do that.  You can convert the file formats
>>  Edward> with "dos2unix" and "unix2dos"
>>  Edward> I never would have guessed, but in the other replies so far,
>>  Edward> they say you can also have svn (or tortoise)  
>> automatically do
>>  Edward> the unix2dos or dos2unix for you.  Essentially yes.  Take  
>> a look at svn:eol-style.  As a rule of thumb,
>> this attribute should always be set (usually to "native") for any  
>> text
>> file.
>> Values other than "native" are sometimes useful.  For example, we  
>> have
>> a nightly build machinery setup where a working directory is checked
>> out on a Unix system, then copied or net-mounted from a Windows  
>> system
>> that has to build some of the bits.  The source files can be  
>> "native",
>> because the Windows compilers accept Unix line endings in the
>> sources.  But control files, like the "project" files, need Windows
>> line endings.  So we set eol-style to CRLF for those.
>
> Paul: is there a way to make "native" the "default", or do we  
> literally
> need to enforce it on every file when checked in?


What you do is this:

On every client, edit the Subversion config file and set up your auto- 
props to automatically set this property to the desired value on all  
files where that would be appropriate.

Then, on the server site, write a pre-commit hook to reject commits  
that do not match your policy.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Subversion and samba

Posted by Scott Sharkey <ss...@linuxunlimited.com>.
Paul Koning wrote:
>>>>>> "Edward" == Edward Harvey <Harvey> writes:
> 
>  Edward> The ^M characters aren't added by svn, they're added by your
>  Edward> text editor.  Cross-platform editors such as vi, gvim, emacs,
>  Edward> and xemacs won't do that.  You can convert the file formats
>  Edward> with "dos2unix" and "unix2dos"
> 
>  Edward> I never would have guessed, but in the other replies so far,
>  Edward> they say you can also have svn (or tortoise) automatically do
>  Edward> the unix2dos or dos2unix for you.  
> 
> Essentially yes.  Take a look at svn:eol-style.  As a rule of thumb,
> this attribute should always be set (usually to "native") for any text
> file.
> 
> Values other than "native" are sometimes useful.  For example, we have
> a nightly build machinery setup where a working directory is checked
> out on a Unix system, then copied or net-mounted from a Windows system
> that has to build some of the bits.  The source files can be "native",
> because the Windows compilers accept Unix line endings in the
> sources.  But control files, like the "project" files, need Windows
> line endings.  So we set eol-style to CRLF for those.

Paul: is there a way to make "native" the "default", or do we literally
need to enforce it on every file when checked in?

-Scott

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: Subversion and samba

Posted by Paul Koning <Pa...@dell.com>.
>>>>> "Edward" == Edward Harvey <Harvey> writes:

 Edward> The ^M characters aren't added by svn, they're added by your
 Edward> text editor.  Cross-platform editors such as vi, gvim, emacs,
 Edward> and xemacs won't do that.  You can convert the file formats
 Edward> with "dos2unix" and "unix2dos"

 Edward> I never would have guessed, but in the other replies so far,
 Edward> they say you can also have svn (or tortoise) automatically do
 Edward> the unix2dos or dos2unix for you.  

Essentially yes.  Take a look at svn:eol-style.  As a rule of thumb,
this attribute should always be set (usually to "native") for any text
file.

Values other than "native" are sometimes useful.  For example, we have
a nightly build machinery setup where a working directory is checked
out on a Unix system, then copied or net-mounted from a Windows system
that has to build some of the bits.  The source files can be "native",
because the Windows compilers accept Unix line endings in the
sources.  But control files, like the "project" files, need Windows
line endings.  So we set eol-style to CRLF for those.

     paul


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: Subversion and samba

Posted by "Harvey, Edward" <Ed...@patni.com>.
The ^M characters aren't added by svn, they're added by your text editor.  Cross-platform editors such as vi, gvim, emacs, and xemacs won't do that.

You can convert the file formats with "dos2unix" and "unix2dos"

I never would have guessed, but in the other replies so far, they say you can also have svn (or tortoise) automatically do the unix2dos or dos2unix for you.  Pretty cool feature.



From: Kota, Sreenivasa ShravanaKumar [mailto:shravanakumar.ks@hp.com]
Sent: Friday, March 14, 2008 5:43 AM
To: users@subversion.tigris.org
Subject: Subversion and samba

Hi All,

I have a subversion working copy in unix. I have configured samba on my unix box so that I can access the working copy from windows.

I have modified files in windows and commit them using TortoiseSVN on windows.

When I check / open the files in unix, I see that there are control-M characters in each file that I committed from windows.

Is there any configuration / settings available in subversion or Tortoise SVN which will avoid adding control characters when files modified and committed from windows.

Also, I don't see the TortoiseSVN Icons on the samba shared working copy in windows.

I appreciate your help


Thanks & Regards,
Shravana Kumar





Re: Subversion and samba

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 14, 2008, at 08:41, Troy Bull wrote:

> On Mar 14, 2008, at 05:28, Ryan Schmidt wrote:
>
>> On Mar 14, 2008, at 05:10, <ni...@planet.nl>  
>> <ni...@planet.nl> wrote:
>>
>>> On Mar 14, 2008, at 04:43, Kota, Sreenivasa ShravanaKumar wrote:
>>>
>>>> I have a subversion working copy in unix. I have configured  
>>>> samba on my unix box so that I can access the working copy from  
>>>> windows. [snip]
>>>
>>> First thing, don't share working copies between OS's. Check out a  
>>> local working copy, and synchronize them with svn up.
>>
>> Sure, where possible, that's the best idea. Sometimes, however, it's
>> nice to share working copies. We did this in the web design shop
>> where I worked. There was one LAMP server (Linux/Apache/MySQL/PHP)
>> and each developer had his or her working copies under /home/
>> <username>/public_html, and they accessed this using Samba from their
>> Windows workstations and used TortoiseSVN to checkout, update,
>> commit, etc. It can work.
>
>
> Why bother?  Why not just check out a working copy on the windows  
> box?  I mean you could dig the grand canyon with a teaspoon, but why?

Because obviously we preferred it to the alternative.

It was a small web site programming shop. The entire company  
consisted of the two founders, a consultant friend of theirs, a  
secretary, and ten web site programmers. No IT staff, no system  
administrators. One of the other programmers and I became the de- 
facto sysadmins, because we liked that kind of stuff. And we  
preferred to spend our time making sure our one Linux server had the  
correct mix of Apache, PHP, PEAR modules, MySQL, ImageMagick,  
Graphviz and the various other tools the sites needed, rather than  
trying to keep all these things updated and working properly on each  
of our ten programmers' workstations. The other programmers did not  
like IT stuff and weren't going to be forced to learn how to do that  
on their own systems. That's not what they were hired for. They were  
hired to program web sites. Also, our sites were hosted on Linux on  
the production side, so we wanted them hosted on Linux on the  
development side too. And we certainly didn't want to invest a whole  
lot of effort into making our sites work on Windows.

Before I helped introduce Subversion to the shop, everyone was  
writing their files directly to a single Samba share, routinely  
clobbering each others' work. Quite a mess. Switching to Subversion  
and writing to individual working copies in home directories mounted  
via Samba was a definite improvement.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Subversion and samba

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 14, 2008, at 05:10, <ni...@planet.nl> <ni...@planet.nl>  
wrote:

>> I have a subversion working copy in unix. I have configured samba  
>> on my unix box so that I can access the working copy from windows.
>>
>> I have modified files in windows and commit them using TortoiseSVN  
>> on windows.
>>
>> When I check / open the files in unix, I see that there are  
>> control-M characters in each file that I committed from windows.
>>
>> Is there any configuration / settings available in subversion or  
>> Tortoise SVN which will avoid adding control characters when files  
>> modified and committed from windows.
>>
>> Also, I don't see the TortoiseSVN Icons on the samba shared  
>> working copy in windows.
>
> First thing, don't share working copies between OS's. Check out a  
> local working copy, and synchronize them with svn up.
>

Sure, where possible, that's the best idea. Sometimes, however, it's  
nice to share working copies. We did this in the web design shop  
where I worked. There was one LAMP server (Linux/Apache/MySQL/PHP)  
and each developer had his or her working copies under /home/ 
<username>/public_html, and they accessed this using Samba from their  
Windows workstations and used TortoiseSVN to checkout, update,  
commit, etc. It can work.

> To prevent ^M (wrong line endings) set the svn:eol-style property  
> to native. That way it will rewrite the files when checking out to  
> contain the right EOL style.
>

In our case, we decided to use LF line endings on all files, and  
configure our Windows editors to recognize and retain LF line  
endings, rather than Windows' usual CRLF. The editor we were using  
(UltraEdit) was rather peculiar in that it required (IIRC) four  
separate settings in order to accomplish this. And developers were  
frequently having to reinstall Windows, and then they forgot to set  
one or more of the required settings in the editor, such that we  
fairly frequently got files committed with the wrong line endings in  
them. This could have been avoided if we had set svn:eol-style=LF on  
all files and/or installed a pre-commit hook to reject commits of  
text files containing ^M.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: Subversion and samba

Posted by ni...@planet.nl.
First thing, don't share working copies between OS's. Check out a local working copy, and synchronize them with svn up. To prevent ^M (wrong line endings) set the svn:eol-style property to native. That way it will rewrite the files when checking out to contain the right EOL style.

Hth,

Nick S.


-----Original Message-----
From: Kota, Sreenivasa ShravanaKumar [mailto:shravanakumar.ks@hp.com]
Sent: Fri 3/14/2008 10:43
To: users@subversion.tigris.org
Subject:  Subversion and samba
 
Hi All,

I have a subversion working copy in unix. I have configured samba on my unix box so that I can access the working copy from windows.

I have modified files in windows and commit them using TortoiseSVN on windows.

When I check / open the files in unix, I see that there are control-M characters in each file that I committed from windows.

Is there any configuration / settings available in subversion or Tortoise SVN which will avoid adding control characters when files modified and committed from windows.

Also, I don't see the TortoiseSVN Icons on the samba shared working copy in windows.

I appreciate your help


Thanks & Regards,
Shravana Kumar






Re: Subversion and samba

Posted by Issac Goldstand <ma...@beamartyr.net>.


Kota, Sreenivasa ShravanaKumar wrote:
>  
> Also, I don't see the TortoiseSVN Icons on the samba shared working copy 
> in windows.
>  

Go to TortoisSVN settings --> Icon Overlays --> Click Network Drives


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org