How to edit log message already committed in Subversion?

前端 未结 10 1610
太阳男子
太阳男子 2020-11-27 23:54

Is there a way to edit the log message of a certain revision in Subversion? I accidentally wrote the wrong filename in my commit message which could be confusing later.

10条回答
  •  情深已故
    2020-11-28 00:33

    The Subversion FAQ covers this, but uses a bunch of confusing undefined terms like REPOS_PATH without giving any actual examples.

    It might take a few tries to get it to work, so save your updated commit message in a file. Unlike with svn-commit.tmp files, Subversion won’t preserve your typing if there’s a problem.

    In your working directory, run

    svn propedit -r N --revprop svn:log

    to edit the commit message. If that works, great! But it probably won’t, because the svn:log revision property is unversioned and Subversion by default will stop you from overwriting it, either with the hook script pre-revprop-change, or an error message that you don’t have such a hook.

    To change the hooks, you need access to the filesystem on which the repository is hosted. svn info will tell you the Repository Root. Suppose it’s ~/svnrepo.

    1. cd to ~/svnrepo/hooks
    2. Is there a pre-revprop-change or pre-revprop-change.bat script? If so, temporarily comment out the part of it that aborts if you try to change svn:log.
    3. Otherwise, on Windows, create a blank file called pre-revprop-change.bat. Here’s one way to do that:

      copy con pre-revprop-change.bat
      ^Z
      
    4. Otherwise, on Unix, run

      echo '#!/bin/sh' > pre-revprop-change
      chmod +x pre-revprop-change
      
    5. In the working copy, run svn propedit -r N --revprop svn:log again

    6. Undo your changes to ~/svnrepo/hooks/svn-revprop-change(.bat)

提交回复
热议问题