简体   繁体   English

在svn:externals(python)上运行replace命令

[英]Run replace command on svn:externals (python)

I am currently writing a python script which needs to run a sed command to replace stuff from the svn:externals data. 我目前正在编写一个python脚本,该脚本需要运行sed命令来替换svn:externals数据中的内容。 I tried to run sed on "svn propedit svn:externals ." 我试图在“ svn propedit svn:externals”上运行sed。 but the outcome is not the one expected. 但是结果却不是预期的。

Does anyone know how to do this ? 有谁知道如何做到这一点 ?

First of all, don't use sed . 首先,不要使用sed Use Python's string methods or the re module. 使用Python的字符串方法或re模块。

Second, I recommend to run svn propget ... first, to fetch the old value. 其次,我建议先运行svn propget ...以获取旧值。 Then, you manipulate it (within Python, no need to run sed ). 然后,您对其进行操作(在Python中,无需运行sed )。 Finally, you run svn propset . 最后,运行svn propset

Alternatively, you could run a second Python script as editor for svn propedit . 另外,您可以运行第二个Python脚本作为svn propedit编辑器。 Here, too, you don't need sed if you already have Python. 在这里,如果您已经拥有Python,也不需要sed。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM