blackbox: consolidate conditions for early return
authorYuya Nishihara <yuya@tcha.org>
Sun, 11 Nov 2018 16:38:43 +0900
changeset 40631 345cdb93851b
parent 40630 5bd3d6b264c1
child 40632 da3bc2f54b02
blackbox: consolidate conditions for early return Just pick the lastui only if it is usable.
hgext/blackbox.py
--- a/hgext/blackbox.py	Sun Nov 11 16:34:49 2018 +0900
+++ b/hgext/blackbox.py	Sun Nov 11 16:38:43 2018 +0900
@@ -157,18 +157,15 @@
 
             if self._bbvfs:
                 ui = self
-            else:
+            elif lastui and lastui._bbvfs:
                 # certain ui instances exist outside the context of
                 # a repo, so just default to the last blackbox that
                 # was seen.
                 ui = lastui
-
-            if not ui:
-                return
-            vfs = ui._bbvfs
-            if not vfs:
+            else:
                 return
 
+            vfs = ui._bbvfs
             repo = ui._bbrepo
             lastui = ui