Search code examples
pythonsvnexternals

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. I tried to run sed on "svn propedit svn:externals ." but the outcome is not the one expected.

Does anyone know how to do this ?


Solution

  • First of all, don't use sed. Use Python's string methods or the re module.

    Second, I recommend to run svn propget ... first, to fetch the old value. Then, you manipulate it (within Python, no need to run sed). Finally, you run svn propset.

    Alternatively, you could run a second Python script as editor for svn propedit. Here, too, you don't need sed if you already have Python.