开发者

Change svn node properties with Python raises a SubversionException

开发者 https://www.devze.com 2023-03-09 21:26 出处:网络
When changing a svn node property with python, using svn.fs.change_node_prop(root, path, \"thisisa:property\", \"andthisisavalue\")

When changing a svn node property with python, using

svn.fs.change_node_prop(root, path, "thisisa:property", "andthisisavalue") 

raises an exception with the message "svn.core.SubversionException: ('Root object must be a transaction root', 160022)"

root is made with this:

canon_path = svn.core.svn_path_canonicalize(repos_path)
repos_ptr = svn.repos.open(canon_path)
fsob = svn.repos.fs(repos_ptr)
headrev = svn.fs.youngest_rev(fsob)
ro开发者_开发问答ot = svn.fs.revision_root(fsob, headrev)

and path is a directory path, like "proyect/a/directory"

I can't find the documentation about svn module in python, so I don't know how to solve this.

Can you help me with this?

Thank you.


I was wrong using root as the head revision root.

I needed to begin a transaction for commit and get it's transaction root.

For doing this I made,

txn = svn.repos.fs_begin_txn_for_commit(repos_ptr, headrev, SVN_COMMIT_USER, SVN_COMMIT_MESSAGE)
root = svn.fs.txn_root(txn)

Hope this helps to anyone.

0

精彩评论

暂无评论...
验证码 换一张
取 消