Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前正在编写一个 python 脚本,它需要运行 sed 命令来替换 svn:externals 数据中的内容。我试图在“svn propedit svn:externals”上运行 sed。但结果却不是预期的。
有谁知道如何做到这一点 ?
首先,不要使用sed. 使用 Python 的字符串方法或re模块。
sed
re
其次,我建议先运行svn propget ...,以获取旧值。然后,您操作它(在 Python 中,无需运行sed)。最后,您运行svn propset.
svn propget ...
svn propset
或者,您可以运行第二个 Python 脚本作为svn propedit. 如果您已经拥有 Python,在这里也不需要 sed。
svn propedit