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

3

8

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

Driblet answered 10/9, 2010 at 7:11 Comment(0)
L
7

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.

Lentiginous answered 10/9, 2010 at 11:49 Comment(0)
L
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.

Limicolous answered 10/9, 2010 at 7:20 Comment(2)
"Revisions in Bazaar are immutable" -- Any other source control system where they aren't?Driblet
People have been seen editing past revision in CVS and Subversion. It's still "bad". But just editing commit messages in a centralized VCS does not break anything (except maybe mirrors to DVCS). In Bazaar, such changes are strictly verboten because they cause integrity violations of the distributed database. In Git and Hg they are impossible by design.Lentiginous
E
0

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.

Euphonize answered 6/12, 2016 at 18:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.