gpt4 book ai didi

非交互式脚本中的 svn propedit

转载 作者:行者123 更新时间:2023-12-04 14:09:06 26 4
gpt4 key购买 nike

我需要在提交发生后编辑文件的 svn 属性。因此,我想使用提交后脚本。

例子:

当我提交名为 example.ex 的文件时,我有一个名为 export 的属性,其值设置为 test提交成功后,我有一个提交后 Hook ,它会做一些聪明的事情(这对我的问题无关紧要),完成后需要更改(或删除)属性 export 到新值,例如 succeeded

在命令行上我会使用这个:

svn propedit "export"  file:///svn/repositoryName/path/to/file/in/repository/example.ex

这将打开我的系统编辑器 vi,我将看到值 test。我可以将其更改为我想要的任何内容,然后使用 :wq

等 vi 命令保存并退出文件

Subversion 返回这样的消息

"svn-prop.tmp" 1L, 10C written
Set new value for property 'export' on file:///svn/repositoryName/path/to/file/in/repository/example.ex'
Committed revision 67.

太好了。但正如我所说,我需要在提交后脚本中使用它,而我无法控制 vi(或者我错了吗?)。

因此 Subversion 让我可以将文件添加到命令 propedit。该文件仅包含新值 succeeded

新命令应该是这样的:

svn propedit "export"  file:///svn/repositoryName/path/to/file/in/repository/example.ex --file /path/to/propertyValueFile/propValue.file

这就是问题所在:最后一个命令不起作用。 vi 再次打开,我需要手动更改我的值。为什么?我做错了什么?

最佳答案

我找到了适合我的解决方案。

svn propedit "export" file:///svn/repositoryName/path/to/file/in/repository/example.ex --file /data/svn/intranet/hooks/fileWithLogMessage --editor-cmd "echo succeeded >"

--editor-cmd 提供了另一个编辑器,我可以使用 echo newValueForProp 智胜 propedit。

现在它就像一个魅力。

--

关于非交互式脚本中的 svn propedit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10549540/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com