This is an archive of the discontinued Mercurial Phabricator instance.

commit: tell user what to do with .hg/last-message.txt
ClosedPublic

Authored by martinvonz on Apr 20 2020, 5:42 PM.

Details

Summary

I have always assumed that the message will be reused by the next `hg
commit`, but it seems it's just silently dropped on the next
commit. Let's try to be more helpful by telling the user that they
have to manually tell hg to reuse it.

The file will still be lost if the user runs some other operation in
between (like a non-in-memory rebase). That will be fixed once we've
switched all operations to be in-memory :)

I didn't include $(hg root)/ in the path in the message to the user
because that would have made the message too long. Hopefully the user
will figure that part out themselves.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Apr 20 2020, 5:42 PM
marmoute requested changes to this revision.Apr 21 2020, 3:25 AM
marmoute added a subscriber: marmoute.

Manual copy pasting is not necessary, hg commit --logfile .hg/last-message.txt can be used to reuse that message and hg commit --logfile .hg/last-message.txt --edit can be used to re-use and edit the message.

I would recommand that instead.

This revision now requires changes to proceed.Apr 21 2020, 3:25 AM

Manual copy pasting is not necessary, hg commit --logfile .hg/last-message.txt can be used to reuse that message and hg commit --logfile .hg/last-message.txt --edit can be used to re-use and edit the message.
I would recommand that instead.

I was worried that other operations in between could lose the message. Won't e.g. a (non-in-memory) rebase lose it?

I don't understand wer you are going with this mention of "other operation". But I don't think they loose it. It only get overwritten when a new one is written.

I don't understand wer you are going with this mention of "other operation". But I don't think they loose it. It only get overwritten when a new one is written.

This is what I meant:

$ cat .hg/last-message.txt
blah
$ hg rebase --config rebase.experimental.inmemory=no -r a0a43ac0 -d b3b383f2
$ cat .hg/last-message.txt
cat: .hg/last-message.txt: No such file or directory

Okay. I am still a bit lost about what do you have in mind ? If the user do not act of the last-message.txt but move to something else, it seems reasonable that it get cleanup, right?

Okay. I am still a bit lost about what do you have in mind ? If the user do not act of the last-message.txt but move to something else, it seems reasonable that it get cleanup, right?

Okay, I'm fine with that. That would still lose the message without warning in some cases, but it's still better than before.

martinvonz edited the summary of this revision. (Show Details)Apr 21 2020, 11:53 AM
martinvonz updated this revision to Diff 21165.
marmoute accepted this revision.Apr 22 2020, 12:24 PM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.