changeset 6387:a87abe69a2f8 stable

topic: branchmap already imports subsettable from repoviewutil Even on hg <= 4.9. But let's add a comment so that we can import from repoviewutil module directly when we drop compatibility with 4.9.
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 05 Feb 2023 18:47:38 +0400
parents e8d85d51c7b2
children 0baef8dde96b
files hgext3rd/topic/server.py hgext3rd/topic/topicmap.py
diffstat 2 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/server.py	Thu Dec 15 17:07:25 2022 +0400
+++ b/hgext3rd/topic/server.py	Sun Feb 05 18:47:38 2023 +0400
@@ -3,6 +3,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 from mercurial import (
+    branchmap,
     extensions,
     repoview,
     wireprototypes,
@@ -10,15 +11,6 @@
     wireprotov1server,
 )
 
-try:
-    from mercurial.utils import (
-        repoviewutil,
-    )
-    repoviewutil.subsettable
-except (AttributeError, ImportError):
-    # hg <= 4.9 (caebe5e7f4bd)
-    from mercurial import branchmap as repoviewutil
-
 from . import (
     common,
     constants,
@@ -102,5 +94,6 @@
 
     if FILTERNAME not in repoview.filtertable:
         repoview.filtertable[FILTERNAME] = computeunservedtopic
-        repoviewutil.subsettable[FILTERNAME] = b'immutable'
-        repoviewutil.subsettable[b'served'] = FILTERNAME
+        # hg <= 4.9 (caebe5e7f4bd)
+        branchmap.subsettable[FILTERNAME] = b'immutable'
+        branchmap.subsettable[b'served'] = FILTERNAME
--- a/hgext3rd/topic/topicmap.py	Thu Dec 15 17:07:25 2022 +0400
+++ b/hgext3rd/topic/topicmap.py	Sun Feb 05 18:47:38 2023 +0400
@@ -44,6 +44,7 @@
 def _setuptopicfilter(ui):
     """extend the filter related mapping with topic related one"""
     funcmap = repoview.filtertable
+    # hg <= 4.9 (caebe5e7f4bd)
     partialmap = branchmap.subsettable
 
     # filter level not affected by topic that we should not override