changeset 3227:873d2f1949e1 stable

topic: use more protective code to access current topic There are some code path where the operation is not properly initialized and lack the new attributes. While the lack of initialization, is suspicious and I've not be able to pin point case where this happens. Currently the code crash when it encounter this situation. So we make the code more resistant to this case to prevent bad user experience.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 05 Dec 2017 13:53:04 +0100
parents 5dfe4e5cf9e4
children 8cc8fb94cc00
files CHANGELOG hgext3rd/topic/__init__.py
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Tue Dec 05 13:21:57 2017 +0100
+++ b/CHANGELOG	Tue Dec 05 13:53:04 2017 +0100
@@ -1,6 +1,13 @@
 Changelog
 =========
 
+7.0.2 - in progress
+-------------------
+
+Topic (0.5.2)
+
+  * makes code more resilient to partiel initialization
+
 7.0.1 -- 2017-11-14
 -------------------
 
--- a/hgext3rd/topic/__init__.py	Tue Dec 05 13:21:57 2017 +0100
+++ b/hgext3rd/topic/__init__.py	Tue Dec 05 13:53:04 2017 +0100
@@ -474,7 +474,7 @@
 
 def wrapinit(orig, self, repo, *args, **kwargs):
     orig(self, repo, *args, **kwargs)
-    if repo.currenttopic:
+    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
@@ -1012,7 +1012,7 @@
     return topicstime
 
 def summaryhook(ui, repo):
-    t = repo.currenttopic
+    t = getattr(repo, 'currenttopic', '')
     if not t:
         return
     # i18n: column positioning for "hg summary"