无论如何,有没有让TortoiseSVN保持EOL(行尾)不变的方式? [英] Is there anyway to get TortoiseSVN to leave EOL (line endings) as is?

查看:311
本文介绍了无论如何,有没有让TortoiseSVN保持EOL(行尾)不变的方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在检出具有Linux样式行结尾(仅LF char)的文件.当我在Windows中使用TortoiseSVN签出文件时,它将行尾转换为Windows样式(CR + LF).我尝试将行添加到subversion配置文件中以强制其使用LF,是的,我确实设置了enable-auto-props = yes.这是行不通的,即使做到了,这也不是我想要的,因为我宁愿TSVN根本不要触摸文件.只需照原样复制即可.

I'm checking out files that have Linux style line endings (just LF char). When I check out a file with TortoiseSVN in Windows, it converts the line endings to Windows style (CR+LF). I've tried adding the lines to the subversion config file to force it to use LF, and yes, I did set the enable-auto-props = yes. This doesn't work, and even if it did, it's not exactly what I want, because I'd rather have TSVN simply not touch the files. Just copy them as is.

推荐答案

正如其他人指出的那样,您需要设置svn:eol-style属性.此属性可以具有三个值:

As others have pointed out, you need to set the svn:eol-style property. This property can have three values:

  • LF:在签出并提交后自动将行尾设置为Unix行尾.
  • CRLF:在签出并提交后自动将行尾设置为Windows行尾.
  • native:这将在提交到Unix行结束符(LF)时存储行结束符,但是将根据客户端使用LFCRLF检出行结束符.
  • LF: Set end-of-lines automatically to Unix line endings upon checkout and commit.
  • CRLF: Set end-of-lines automatically to Windows line endings upon checkout and commit.
  • native: This will store line endings upon commit to Unix line endings (LF), but will checkout the line endings with either LF or CRLF based upon the client.

您可以在$ HOME/.subversion/config文件中设置auto-props设置,以自动将此属性附加到所有新文件.但是,这是每个用户必须在其Subversion客户端中设置的设置.要强制设置此属性,您可以使用我的预提交钩子如果您指定的文件没有将您指定的属性设置为正确的值,则将拒绝提交.

You can set the auto-props settings in your $HOME/.subversion/config file to automatically attach this property to all new files. However, this is something each user must set in their Subversion client. To enforce setting this property, you can use my pre-commit hook which will reject commits if the files you've specified don't have the properties you've specified set to their correct values.

这是一个粗略的错误,因为它无法解决问题,但是在一两次提交失败之后,开发人员将快速设置其自动道具以自动添加所需的属性.

This is a crude bludgeon since it won't correct the problem, but after one or two failed commits, developers will quickly set their auto-props up to automatically add the needed properties.

对于Windows上的TortoiseSVN,请在用户名/AppData(隐藏文件夹)下找到配置文件.例如

For TortoiseSVN on Windows, find the config file under your username/AppData (a hidden folder). E.g.

%appdata%\ roaming \ subversion \ config

%appdata%\roaming\subversion\config

添加以下行(可能已经存在,但已注释掉),然后注销/登录:

Add these lines (probably already there, but commented out), then logout/in:

enable-auto-props = yes
# Add these for each text file type that you use:
*.txt = svn:eol-style=native
*.cs = svn:eol-style=native
*.xml = svn:eol-style=native

(示例是使用XML的C#;请替换为您使用的任何文本文件.)

(Example is for C# with XML; replace with whatever text files you use.)

这篇关于无论如何,有没有让TortoiseSVN保持EOL(行尾)不变的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆