changeset 1874:ec28b6c3414a

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.
author Augie Fackler <raf@durin42.com>
date Fri, 11 Dec 2015 12:53:20 -0500
parents 04c971850183
children 594ca2f3d1de
files src/topic/__init__.py tests/test-topic.t
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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