# HG changeset patch # User Augie Fackler # Date 1449856400 18000 # Node ID ec28b6c3414aedf3988f5a9b790fa9a25f8096e0 # Parent 04c9718501837d2854248b102f1e953cb82cfbf8 topic: fix changing topics of commits that have an amend_source Includes a test for this specific case, but we should probably spend more time squinting at the interactions between the current topic wrapper function and commitctx for memctx instances. diff -r 04c971850183 -r ec28b6c3414a src/topic/__init__.py --- a/src/topic/__init__.py Fri Dec 11 12:53:38 2015 -0500 +++ b/src/topic/__init__.py Fri Dec 11 12:53:20 2015 -0500 @@ -131,6 +131,13 @@ del fixedextra[constants.extrakey] else: fixedextra[constants.extrakey] = topic + if 'amend_source' in fixedextra: + # TODO: right now the commitctx wrapper in + # topicrepo overwrites the topic in extra if + # amend_source is set to support 'hg commit + # --amend'. Support for amend should be adjusted + # to not be so invasive. + del fixedextra['amend_source'] ui.debug('changing topic of %s from %s to %s\n' % ( c, oldtopic, newtopic)) ui.debug('fixedextra: %r\n' % fixedextra) diff -r 04c971850183 -r ec28b6c3414a tests/test-topic.t --- a/tests/test-topic.t Fri Dec 11 12:53:38 2015 -0500 +++ b/tests/test-topic.t Fri Dec 11 12:53:20 2015 -0500 @@ -637,3 +637,6 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: fran? +Readding the same topic with topic --change should work: + $ hg topic --change . watwat + changed topic on 1 changes