如何针对 URL 使用 subversion 的 propset?

发布于 2024-12-26 11:14:05 字数 878 浏览 1 评论 0原文

是否可以仅通过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

可遇━不可求 2025-01-02 11:14:05

是的,虽然这有点麻烦; 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"

花辞树 2025-01-02 11:14:05

您可以使用 svnmucc< /a> 命令以非交互方式设置 URL 的属性,例如 svn:externals

示例:

$ svnmucc --root-url https://example.com/svn -m 'reference other/yap' \
   propset svn:externals "^/otherproject/tag/xyz other
^/yetanother/tag/123 yap" myproject/trunk

请注意,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 as svn:externals.

Example:

$ svnmucc --root-url https://example.com/svn -m 'reference other/yap' \
   propset svn:externals "^/otherproject/tag/xyz other
^/yetanother/tag/123 yap" myproject/trunk

Note that svnmucc also supports other commands besides propset 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 the subversion-tools package. OpenCSW even includes it in the main subversion package.

只怪假的太真实 2025-01-02 11:14:05

不。更改文件的属性就像更改文件本身一样——您需要一个工作目录。有一些 Subversion 命令可以在不需要工作副本的情况下更改提交:svn cpsvn mkdirsvn 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, and svn 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).

菩提树下叶撕阳。 2025-01-02 11:14:05

基于 Willem 的优秀答案,这里有一个示例,展示了如何为<设置 SVN auto-props code>needs-lock 用于所有文件,mime-type 用于使用 URL 的特定扩展:

svn propedit svn:auto-props --editor-cmd "echo \"* = svn:needs-lock=*
*.os = svn:mime-type=application/octet-stream
*.osproj = svn:mime-type=application/octet-stream\" >" http://example.com/svn/myproject/trunk -m "Setting auto-props."

Building upon Willem's excellent answer, here's an example showing how to set SVN auto-props for needs-lock for all files and mime-type for particular extensions using a URL:

svn propedit svn:auto-props --editor-cmd "echo \"* = svn:needs-lock=*
*.os = svn:mime-type=application/octet-stream
*.osproj = svn:mime-type=application/octet-stream\" >" http://example.com/svn/myproject/trunk -m "Setting auto-props."
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文