diff hgext3rd/topic/__init__.py @ 4125:865c33c16508 stable

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 22 Sep 2018 13:09:06 +0200
parents 23658110ab26
children 099e264bf3be
line wrap: on
line diff
--- 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):