追溯性地更改 SVN 提交消息?

我想重写大量的 SVN 提交消息到一个不同的结构,例如前缀一个类别。来自:

"foo" now accepts "bar" format for connection string.

我想

core - database - "foo" now accepts "bar" format for connection string.

是否有一种简单的方法可以做到这一点,即 没有包括使用 svndumpfilter转储整个存储库?

我在客户端使用 TortoiseSVN,在服务器端使用 VisualSVN。(VisualSVN 是经典 svn的包装器,我也可以通过命令行与它交谈。)

59243 次浏览

Use svn propset on the svn:log property. Examples in the svn book.

Yes, commit messages can be changed. They are implemented as properties on revisions, similar to the regular file-properties.

In the TortoiseSVN Log window you can right click on a commit and select "Edit log message".

You can certainly change log messages retroactively, it's covered in the FAQ. I'm not sure how the command line interface for VisualSVN works, but for vanilla svn the command would be

svn propset -r N --revprop svn:log "new log message" URL

If you want to do this for all revisions without dumping the repository and re-loading, you could script this command to work on a list of all revisions. It would take some time to do this way, depending on the size of your repository, but in principle there's no reason you can't do it, and it does not involve a dump and reload.

Also, vanilla SVN has a command svnlook which is sort of an administrative tool that works directly with the repository files. That tool doesn't understand URLs (you must have filesystem-level access to the repository), but is much faster. The syntax is a little different, but you can modify properties in the same way using that tool.

Yes, you can, but you need to enable it on the repository first.

In the repository, in the hooks directory, is a file called pre-revprop-change.tmpl. It's got a couple of pages of comments on what it does, and comes set up to only allow changes to the log properties. To enable it, rename the file to pre-revprop-change and make it executable (I'm assuming a POSIX-hosted subversion, if you're using Windows to host, you might find this message useful).

Once the repository allows it, you can use Tortoise to change the log message for a commit from the right-click menu on a commit, or you can use the command line.

Just came accross this post with the exact problem, usingTortoise SVN for client and VisualSVN on a Windows server.

If you happen to have an "a DAV request failed" error message, give a look at Andrew Aylett's answer and go edit "pre-revprop-change.tmpl" in your repository hooks subdirectory.

Once this is done hitting "edit log message" in the contextual menu should finally work!

svn propedit -r N --revprop svn:log URL

URL above is optional if you're already in a working directory. An editor will then appear so that the message can be changed.