diff -r 8be0c63535b5 -r 7c4b98a4e536 mercurial/context.py --- a/mercurial/context.py Fri Dec 20 15:50:13 2019 -0800 +++ b/mercurial/context.py Tue Jan 28 14:07:57 2020 -0800 @@ -2487,6 +2487,17 @@ editor=editor, ) + def tomemctx_for_amend(self, precursor): + extra = precursor.extra().copy() + extra[b'amend_source'] = precursor.hex() + return self.tomemctx( + text=precursor.description(), + branch=precursor.branch(), + extra=extra, + date=precursor.date(), + user=precursor.user(), + ) + def isdirty(self, path): return path in self._cache