免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1200 | 回复: 0
打印 上一主题 下一主题

Set file property in Subversion [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-01-13 21:05 |只看该作者 |倒序浏览

                Subversion provides a flexible feature to set the properties for files in repository, which includes user customeed properties, keyword expansion, and SVN built-in properties. This paper will introduct how to set the properties for a file, and how to use these properties in development.
1. Customed Properties
SVN allows user set any property on a file in SVN repository with the command svn propset, as following example:
svn propset user_desc "Descriptions on this file" file
This command will add a property "user_desc" on the file, and you can check current properties set on the file:
svn proplist file
then you can get the property of the file:
svn propget user_desc file
To update the property, command svn propedit can help you implement it:
svn propedit user_desc file
Finally, you can remove the property from file using command svn propdel:
svn propdel user_desc file
And what I must reminder is that you should commit your property operation into the repository.
2. Keyword Expansion
Keyword expansion basically means getting your version control system to modify your working copy files as it checks them out and updates them so it can fill in useful information for you. Each of these useful pieces of information is represented by a keyword, ususally surrounded by dollar signs, which you put strategically inside the files you're storing in version constrol. Subversion offers the following keyword:
  • $LastChangedDate$
  • $LastChangedRevision$
  • $LastChangedBy$
  • $HeadURL$
  • $Id$
To switch on keyword expansion, you need to set svn:keywords on each file containing keywords.
3. Built-in Properties
Subversion provides some built-in properties for user to control the stored file. This paper just introduces some common properties used in development.
1) Ignore Certain Files
In development, some meta files are often created automatically, such as .o files for the .c/cpp files. When we use svn stat to check what have been modified in the project, these meta files will be shown as the symbol "?". To ignore these certain file in the result, we should set the property svn:ignore for specified directory with the specified file postfix as following:.
*.o
*.pyc
2) Setting End-of-Line Style
As we know, the carriage-return will use different control characters to denote the end of a line of text in different system, just like Windows using CRLF, while Linux using LF.
Subversion can do a conversion for you if you set svn:eol-style property to one of the values in the following table:
native
Subversion will translate end-of-line characters to
whatever the client operating system expects, and so
will use CRLF on Windows and LF on Unix.
CRLF
Subversion will always use CRLF as an end-of-line
marker when it creates files in the working copy.
LF
Subversion will always use LF as an end-of-line
marker on the client.
CR
Subversion will always use CR as an end-of-line
marker on the client.
3) Executable Flag
In Unix like system, we often need to set the executable flag for certain files, such as shell script files. Subversion will not set the execute bit automatically when you check in these files. Command svn:executable will help you set the execute bit on the specified files.
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/48729/showart_463723.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP