Can I edit the message of an older revision in Bazaar?

北战南征 提交于 2019-12-22 04:35:22

问题


How can I edit an older revision's message to more correctly describe its changes?


回答1:


You cannot edit the commit message of an old revision without changing the revision id of the modified revision and all its descendants.

Well... technically you can, if you try hard enough, but the technical term for the result is "corrupt repository". A repository in bzr is a replica of a distributed database of revisions, and if all replicas don't agree on the content of a revision, you have an integrity violation. Meaning, all bets are off, and the system will actively try to detect such situations and refuse to work.

To modify the commit message of the last revision in a branch, you can use "bzr uncommit", followed by "bzr commit" with the new commit message.

To modify the commit message of an older revision, you get a branch whose last revision you want to modify, use "uncommit" then "commit", and re-attach the subsequent revisions using "bzr rebase" or "bzr replay" (from the "rewrite" plugin).

In every case, that will produce a branch which is considered "divergent" from the one you had initially. If the initial branch was published, your original revisions can come back to cause painful merges, history pollution, and generally haunt you.




回答2:


No, you can't edit commit messages for older revisions. Revisions in Bazaar are immutable. You would have to reconstruct the branch from the revision you have to change.




回答3:


if it was the revision you last committed, you can bzr commit --unchanged to add something to the log. that isn't what you want, but it might be the next best thing if ddaa's warnings matter to you.



来源:https://stackoverflow.com/questions/3682817/can-i-edit-the-message-of-an-older-revision-in-bazaar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!