topic: respect preexisting 'topic' value on workingcommitctx stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 22 Sep 2018 13:09:06 +0200
branchstable
changeset 4125 865c33c16508
parent 4124 23658110ab26
child 4126 099e264bf3be
child 4156 f996596d8ccc
topic: respect preexisting 'topic' value on workingcommitctx Mercurial's core changeset: 6c8ceebce309 revealed an issue. If the creator of a workingcommitctx explicitly assigned a 'topic', it was silently overridden by the current active on. This break import of patch with topic information. We now respect preexisting topic information.
hgext3rd/topic/__init__.py
--- a/hgext3rd/topic/__init__.py	Fri Sep 21 19:49:28 2018 +0200
+++ b/hgext3rd/topic/__init__.py	Sat Sep 22 13:09:06 2018 +0200
@@ -553,11 +553,12 @@
 
 def wrapinit(orig, self, repo, *args, **kwargs):
     orig(self, repo, *args, **kwargs)
-    if getattr(repo, 'currenttopic', ''):
-        self._extra[constants.extrakey] = repo.currenttopic
-    else:
-        # Empty key will be dropped from extra by another hack at the changegroup level
-        self._extra[constants.extrakey] = ''
+    if constants.extrakey not in self._extra:
+        if getattr(repo, 'currenttopic', ''):
+            self._extra[constants.extrakey] = repo.currenttopic
+        else:
+            # Empty key will be dropped from extra by another hack at the changegroup level
+            self._extra[constants.extrakey] = ''
 
 def wrapadd(orig, cl, manifest, files, desc, transaction, p1, p2, user,
             date=None, extra=None):