如何针对 URL 使用 subversion 的 propset?
是否可以仅通过 URL 来操作 svn:externals
等 subversion 属性? (即没有工作副本。)
我想要一个脚本,将 svn:externals 固定到给定颠覆 URL 的特定修订版,但这似乎是不可能的:(
$ svn propset foo bar https://example.com/svn/myproject/trunk
svn: Setting property on non-local target 'https://example.com/svn/myproject/trunk' needs a base revision
$ svn propset foo bar -r HEAD https://example.com/svn/myproject/trunk
svn: Try 'svn help' for more info
svn: Cannot specify revision for setting versioned property 'foo'
$ svn propset foo bar --revprop -r HEAD https://example.com/svn/myproject/trunk
svn: DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent
svn: At least one property change failed; repository is unchanged
svn: Error setting property 'foo':
could not remove a property
如果我也使用实际的修订号而不是 HEAD
。)
Is it possible to manipulate a subversion property such as svn:externals
via a URL only? (i.e. without having a working copy.)
I'd like a script that pins svn:externals
to a particular revision given a subversion URL, but this seems to be impossible:
$ svn propset foo bar https://example.com/svn/myproject/trunk
svn: Setting property on non-local target 'https://example.com/svn/myproject/trunk' needs a base revision
$ svn propset foo bar -r HEAD https://example.com/svn/myproject/trunk
svn: Try 'svn help' for more info
svn: Cannot specify revision for setting versioned property 'foo'
$ svn propset foo bar --revprop -r HEAD https://example.com/svn/myproject/trunk
svn: DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent
svn: At least one property change failed; repository is unchanged
svn: Error setting property 'foo':
could not remove a property
(I get the same results if I use an actual revision number instead of HEAD
as well.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,虽然这有点麻烦; svn propedit 可以更改 URL 目标:
svn propedit foo --editor-cmd "echo bar>" http://example.com/svn/myproject/trunk -m“属性已更改”
Yes, although it's a bit of a hack; svn propedit can change URL targets:
svn propedit foo --editor-cmd "echo bar>" http://example.com/svn/myproject/trunk -m "Property changed"
您可以使用
svnmucc
< /a> 命令以非交互方式设置 URL 的属性,例如svn:externals
。示例:
请注意,
svnmucc
还支持除propset
之外的其他命令,并且可以在一次调用中链接多个命令(因此得名)。结果只是一个变更集。svnmucc
命令是 subversion 源包的一部分,通常可以通过发行版的包管理器获得。例如,Fedora 25 将其包含在subversion-tools
包中。 OpenCSW 甚至将其包含在主 subversion 包中。You can use the
svnmucc
command to non-interactively set properties of an URL such assvn:externals
.Example:
Note that
svnmucc
also supports other commands besidespropset
and it is possible to chain multiple commands in one call (hence the name). The result is just one changeset.The
svnmucc
command is part of the subversion source package and usually available via the distribution's package manager. For example, Fedora 25 includes it in thesubversion-tools
package. OpenCSW even includes it in the main subversion package.不。更改文件的属性就像更改文件本身一样——您需要一个工作目录。有一些 Subversion 命令可以在不需要工作副本的情况下更改提交:
svn cp
、svn mkdir
和svn delete
。其他一切都需要一个工作目录才能进行更改。顺便说一句,您可以在没有工作副本的情况下对修订版属性进行更改。修订属性包括提交注释 (svn:log)、提交者 ID (svn:author) 和提交时间 (svn:date)。
No. Changing a property on a file is like changing the file itself -- you need a working directory. There are a few Subversion commands that change the commit without requiring a working copy:
svn cp
,svn mkdir
, andsvn delete
. Everything else needs a working directory in order to make changes.By the way, you can make changes on revision properties without a working copy. Revision properties are things like the commit comment (svn:log), the committer's ID (svn:author), and the time of the commit (svn:date).
基于 Willem 的优秀答案,这里有一个示例,展示了如何为<设置 SVN
auto-props
code>needs-lock 用于所有文件,mime-type
用于使用 URL 的特定扩展:Building upon Willem's excellent answer, here's an example showing how to set SVN
auto-props
forneeds-lock
for all files andmime-type
for particular extensions using a URL: