changeset 6785:cf1e854f50e9 stable

topic: compatibility for scmutil.combined_filtered_and_obsolete_hash()
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 17 May 2024 15:07:04 +0400
parents 4657010685af
children ae01e2b10419
files hgext3rd/topic/discovery.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/discovery.py	Fri May 17 15:06:33 2024 +0400
+++ b/hgext3rd/topic/discovery.py	Fri May 17 15:07:04 2024 +0400
@@ -240,12 +240,13 @@
 #
 # Handle this by doing an extra check for new head creation server side
 def _nbheads(repo):
-    code = scmutil.filteredhash.__code__
-    if r'needobsolete' not in code.co_varnames[:code.co_argcount]:
-        # hg <= 6.0 (053a5bf508da)
-        filterfn = _filter_obsolete_heads
-    else:
-        filterfn = lambda repo, heads: heads
+    filterfn = lambda repo, heads: heads
+    if util.safehasattr(scmutil, 'filteredhash'):
+        # hg <= 6.7 (a03fa40afd01)
+        code = scmutil.filteredhash.__code__
+        if 'needobsolete' not in code.co_varnames[:code.co_argcount]:
+            # hg <= 6.0 (053a5bf508da)
+            filterfn = _filter_obsolete_heads
     data = {}
     for b in repo.branchmap().iterbranches():
         namedbranch, tns, topic = common.parsefqbn(b[0])