同步你的subversion repository Gentoo里gnome下修改qt程序的外观
Mar 16

  在cvs中这个比较好做。只要在文件中有这样的字条串
  @version $Id: ForumAtta.java Exp $
cvs就会将$Id....$这段内容换成该文件的最后提交日期和提交人的信息
  @version $Id: ForumAtta.java,v 1.1 2006/11/09 13:58:50 rory Exp $
但是在subversion中仅仅这样就不行了,那我们该怎样做呢。
首先我们可以使用subclipse来手工添加这些属性
subversion_set_by_hand
在下拉框中选择 svn:keywords 值就填上 Id Reversion Date
show_props
这种方法虽然可用,但是用起来不太现实,我们需要给某些文件自动的添加这些属性。那我们就要修改本地的subversion配置了
gentoo rory # cd ~/.subversion
gentoo .subversion # vi config

找到文件的最后一段
[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.
# *.c = svn:eol-style=native
# *.cpp = svn:eol-style=native
# *.h = svn:eol-style=native
# *.dsp = svn:eol-style=CRLF
# *.dsw = svn:eol-style=CRLF
# *.sh = svn:eol-style=native;svn:executable
# *.txt = svn:eol-style=native
# *.png = svn:mime-type=image/png
# *.jpg = svn:mime-type=image/jpeg
# Makefile = svn:eol-style=native

我们为需要自动设置属性的文件添加配置
[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.
# *.c = svn:eol-style=native
# *.cpp = svn:eol-style=native
# *.h = svn:eol-style=native
# *.dsp = svn:eol-style=CRLF
# *.dsw = svn:eol-style=CRLF
# *.sh = svn:eol-style=native;svn:executable
# *.txt = svn:eol-style=native
# *.png = svn:mime-type=image/png
# *.jpg = svn:mime-type=image/jpeg
# Makefile = svn:eol-style=native
*.java = svn:keywords=Id Reversion Date
*.xml = svn:keywords=Id Reversion Date

这样的话以后我们添加的java和xml文件只要文件里有 $Id$,$Reversion$,$Date$ 这些字符都会自动替换成最后提交的相关属性.
before_auto_props
after_auto_props


Like others

3 Responses to “如何让subversion自动添加Id,Revision等keywords”

  1. 莫多(somebody) Says:

    忘了说windows下的配置文件路径了。
    应该是在
    C:\Documents and Settings\YouUsername\Application Data\Subversion
    目录下。

  2. tianyue Says:

    呵呵 ,一直都再关注你的blog,猜猜我是谁,进www.bashu.info看看 吧。

  3. 莫多(somebody) Says:

    谢谢关注。强。用E文写。
    刚刚搭起来的吧。不过我还是没有猜出来你是谁。

Leave a Reply

Identifying Code