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.
--- 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):