名称

svn propset (pset, ps) — Set PROPNAME to PROPVAL on files, directories, or revisions.

概要

svn propset PROPNAME [PROPVAL | -F VALFILE] PATH...

svn propset PROPNAME --revprop -r REV [PROPVAL | -F VALFILE] [TARGET]

描述

Set PROPNAME to PROPVAL on files, directories, or revisions. The first example creates a versioned, local property change in the working copy, and the second creates an unversioned, remote property change on a repository revision (TARGET determines only which repository to access).

[提示] 提示

Subversion has a number of special properties that affect its behavior. See 第 10 节 “Subversion 属性” later in this chapter for more on these properties.

选项

--changelist ARG
--depth ARG
--encoding ENC
--file (-F) FILENAME
--force
--quiet (-q)
--recursive (-R)
--revision (-r) REV
--revprop
--targets FILENAME

例子

设置文件的 MIME 类型:

$ svn propset svn:mime-type image/jpeg foo.jpg 
property 'svn:mime-type' set on 'foo.jpg'

在UNIX系统,如果你希望一个文件设置执行权限:

$ svn propset svn:executable ON somescript
property 'svn:executable' set on 'somescript'

或许为了合作者的利益你有一个内部的属性设置:

$ svn propset owner sally foo.c
property 'owner' set on 'foo.c'

如果你在特定修订版本的日志信息里有一些错误,并且希望修改,可以使用--revprop设置svn:log为新的日志信息:

$ svn propset --revprop -r 25 svn:log "Journaled about trip to New York."
property 'svn:log' set on repository revision '25'

或者,你没有工作副本,你可以提供一个URL:

$ svn propset --revprop -r 26 svn:log "Document nap." \
              http://svn.red-bean.com/repos
property 'svn:log' set on repository revision '25'

Lastly, you can tell propset to take its input from a file. You could even use this to set the contents of a property to something binary:

$ svn propset owner-pic -F sally.jpg moo.c 
property 'owner-pic' set on 'moo.c'
[注意] 注意

By default, you cannot modify revision properties in a Subversion repository. Your repository administrator must explicitly enable revision property modifications by creating a hook named pre-revprop-change. See 第 3.2 节 “实现版本库钩子” for more information on hook scripts.