Visual SVN自动给文件加锁

在使用SVN作为版本控制器的时候,在VS里安装VISUALSVN插件,当修改文件公共文件的时候需要先Get Lock,如果对于多次操作这个鼠标操作显得是一些复杂,自动给文件加锁的操作实际是给文件加一个属性:needs-lock

如果配置自动加锁:

修改配置文件:

C:\Documents and Settings\[USER_NAME]\Application Data\Subversion\config
或者
C:\Users\[USER_NAME]\Application Data\Subversion\config

 修改两部分:[miscellany] 和[auto-props] 

[miscellany]
enable-auto-props = yes
[auto-props]
### The format of the entries is:
###   file-name-pattern = propname[=value][;propname[=value]...]
### The file-name-pattern can contain wildcards (such as '*' and
### '?').  All entries which match will be applied to the file.
### Note that auto-props functionality must be enabled, which
### is typically done by setting the 'enable-auto-props' option.
*.bmp = svn:mime-type=image/bmp;svn:needs-lock=*
*.gif = svn:mime-type=image/gif;svn:needs-lock=*
*.ico = svn:mime-type=image/x-icon;svn:needs-lock=*
*.jpeg = svn:mime-type=image/jpeg;svn:needs-lock=*
*.jpg = svn:mime-type=image/jpeg;svn:needs-lock=*
*.png = svn:mime-type=image/png;svn:needs-lock=*
*.tif = svn:mime-type=image/tiff;svn:needs-lock=*
*.tiff = svn:mime-type=image/tiff;svn:needs-lock=*

*.doc = svn:mime-type=application/msword;svn:needs-lock=*
*.jar = svn:mime-type=application/octet-stream;svn:needs-lock=*
*.odc = svn:mime-type=application/vnd.oasis.opendocument.chart;svn:needs-lock=*
*.odf = svn:mime-type=application/vnd.oasis.opendocument.formula;svn:needs-lock=*
*.odg = svn:mime-type=application/vnd.oasis.opendocument.graphics;svn:needs-lock=*
*.odi = svn:mime-type=application/vnd.oasis.opendocument.image;svn:needs-lock=*
*.odp = svn:mime-type=application/vnd.oasis.opendocument.presentation;svn:needs-lock=*
*.ods = svn:mime-type=application/vnd.oasis.opendocument.spreadsheet;svn:needs-lock=*
*.odt = svn:mime-type=application/vnd.oasis.opendocument.text;svn:needs-lock=*
*.pdf = svn:mime-type=application/pdf;svn:needs-lock=*
*.ppt = svn:mime-type=application/vnd.ms-powerpoint;svn:needs-lock=*
*.ser = svn:mime-type=application/octet-stream;svn:needs-lock=*
*.swf = svn:mime-type=application/x-shockwave-flash;svn:needs-lock=*
*.vsd = svn:mime-type=application/x-visio;svn:needs-lock=*
*.xls = svn:mime-type=application/vnd.ms-excel;svn:needs-lock=*
*.zip = svn:mime-type=application/zip;svn:needs-lock=*

 在[auto-props]部分是文件类型,一些其他的文件类型:

# Code formats
*.as = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.bat = svn:eol-style=CRLF; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain; svn:executable
*.cmd = svn:eol-style=CRLF; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain; svn:executable
*.c = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.cfc = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.cfm = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.cgi = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn-mine-type=text/plain
*.cpp = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.groovy = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.gsp = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.h = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.java = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.js = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/javascript
*.jsp = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.m = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.php = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/x-php
*.pl = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/x-perl; svn:executable
*.pm = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/x-perl
*.py = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/x-python; svn:executable
*.sh = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/x-sh; svn:executable
# Image formats
*.bmp = svn:mime-type=image/bmp
*.gif = svn:mime-type=image/gif
*.ico = svn:mime-type=image/ico
*.jpeg = svn:mime-type=image/jpeg
*.jpg = svn:mime-type=image/jpeg
*.png = svn:mime-type=image/png
*.tif = svn:mime-type=image/tiff
*.tiff = svn:mime-type=image/tiff
# Data formats
*.avi = svn:mime-type=video/avi
*.doc = svn:mime-type=application/msword
*.eps = svn:mime-type=application/postscript
*.gz = svn:mime-type=application/gzip
*.jar = svn:mime-type=application/java-archive
*.mov = svn:mime-type=video/quicktime
*.mp3 = svn:mime-type=audio/mpeg
*.pdf = svn:mime-type=application/pdf
*.ppt = svn:mime-type=application/vnd.ms-powerpoint
*.ps = svn:mime-type=application/postscript
*.psd = svn:mime-type=application/photoshop
*.rtf = svn:mime-type=text/rtf
*.swf = svn:mime-type=application/x-shockwave-flash
*.tar = svn:mime-type=application/x-tar
*.tgz = svn:mime-type=application/gzip
*.wav = svn:mime-type=audio/wav
*.xls = svn:mime-type=application/vnd.ms-excel
*.zip = svn:mime-type=application/zip
# Text formats
.htaccess = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.cfg = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.css = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/css
*.csv = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.dtd = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/xml
*.htm = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/html
*.html = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/html
*.ini = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.properties = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.sql = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/x-sql
*.txt = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
*.xhtml = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/xhtml+xml
*.xml = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/xml
*.xsd = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/xml
*.xsl = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/xml
*.xslt = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/xml
*.xul = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/xul
*.yml = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
AUTHORS = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
BUGS = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
CHANGES = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
COPYING* = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
DEPENDENCIES = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
DEPRECATED = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
INSTALL* = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
LICENSE = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
Makefile* = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
MANIFEST* = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
PLATFORMS = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
README = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain
TODO = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain

 参考文献:

Automatic lock-modify-unlock

Subversion Auto Properties

 另参阅:

设置 SVN 文件的 MIME 类型

Wish it helps~

posted @ 2014-04-12 16:13  佯林  阅读(1276)  评论(0编辑  收藏  举报