src/topic/__init__.py
changeset 1872 4fcee38d71d6
parent 1871 58ef5699fb35
child 1873 04c971850183
--- a/src/topic/__init__.py	Wed Oct 21 01:09:15 2015 +0200
+++ b/src/topic/__init__.py	Fri Dec 11 12:56:23 2015 -0500
@@ -21,6 +21,7 @@
 from mercurial import lock
 from mercurial import merge
 from mercurial import namespaces
+from mercurial import node
 from mercurial import obsolete
 from mercurial import patch
 from mercurial import phases
@@ -120,19 +121,26 @@
                    except error.ManifestLookupError:
                        return None
                fixedextra = dict(c.extra())
+               ui.debug('old node id is %s\n' % node.hex(c.node()))
+               ui.debug('origextra: %r\n' % fixedextra)
                newtopic = None if clear else topic
-               if fixedextra.get(constants.extrakey, '') == topic:
+               oldtopic = fixedextra.get(constants.extrakey, None)
+               if oldtopic == newtopic:
                    continue
-               if clear and constants.extrakey in fixedextra:
+               if clear:
                    del fixedextra[constants.extrakey]
                else:
                    fixedextra[constants.extrakey] = topic
                c.parents()
+               ui.debug('changing topic of %s from %s to %s\n' % (
+                   c, oldtopic, newtopic))
+               ui.debug('fixedextra: %r\n' % fixedextra)
                mc = context.memctx(
                    repo, (c.p1().node(), c.p2().node()), c.description(),
                    c.files(), filectxfn,
                    user=c.user(), date=c.date(), extra=fixedextra)
                newnode = repo.commitctx(mc)
+               ui.debug('new node id is %s\n' % node.hex(newnode))
                needevolve = needevolve or (len(c.children()) > 0)
                obsolete.createmarkers(repo, [(c, (repo[newnode],))])
                rewrote += 1