Wishlist: the ability to correct wrong commit messages.

Steve Fink sphink at gmail.com
Wed Jul 10 18:10:39 UTC 2019


On 7/1/19 11:05 AM, Richard Hipp wrote:
> On 7/1/19, Tony Mechelynck <antoine.mechelynck at gmail.com> wrote:
>> With Mercurial, a commit description (unlike e.g. a tag name) is
>> considered part of the commit;
> Correct.  But that does *not* mean that the commit description
> contained in the commit itself must necessarily be the text that is
> display with history listings.  You could (I suppose - I'm not up on
> Mecurial internals) while showing a history, test each check-in to see
> if it has a "commit-edit" tag, then show the value of the commit-edit
> tag in place of the description that is part of the commit itself.
> No?
>
Personally, I can't see any fundamental problem with this. And I would 
find it useful; my usual scenario is accidentally pushing with the wrong 
bug number. Standard procedure is to back out the patch (as in, commit 
an inverse of the patch) and then re-land with the fixed message. That 
will work for `hg annotate` output, at least when looking at the tip.

But it *is* a little weird -- if you have an extra object or entry in 
your repository that only affects log output but does not affect any of 
the hashes, then you also have to have separate mechanisms for 
propagating that information.

   "I still see your old commit message. I'm at rev 40ffbce66181. What 
rev are you at?"

   "I'm at 40ffbce66181 too. Try pulling again, I guess?"

   "Oh, great! That fixed it!".

Survivable. But you lose the property that the complete visible state of 
your repository can no longer be tied to a single hash number. 
(Invisible state can already vary; the delta packing of two observably 
identical repositories can differ, for example.)

I suppose the next level of workaround would be to create a commit to 
represent these deeper changes, a "metadata updated" commit that has no 
content itself and is parented to your current tree topological tip. But 
now that means that when you do hg export -r someoldchangeset (or hg log 
-r ...), you can no longer think of it as looking at things at a past 
point in time (since presumably you want to see the updated commit 
message.) Now the output is dependent not only on the revision you're 
requesting, but also your checked out revision. Two checkouts that both 
contain that same revision will output something different for the command.

Hm... one last though. Perhaps the most principled approach would be to 
maintain the restriction that changeset evolution applies only to 
non-public commits for content changes, but extend it to work on 
metadata changes to public changesets. I don't have a good sense for how 
many headaches that would cause. (I mean, obviously it makes it easier 
to change the commit message on revision 0, and thus change every hash 
in your repository, but that's probably a "don't do that then" type of 
thing.)





More information about the Mercurial mailing list