changeset 6125:885a972d5069

topic: no need to filter obsolete heads in Mercurial 6.1
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 06 Feb 2022 13:05:17 +0300
parents cd313b2e57fb
children e314f6207e5f
files hgext3rd/topic/discovery.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/discovery.py	Sat Feb 05 11:08:12 2022 +0300
+++ b/hgext3rd/topic/discovery.py	Sun Feb 06 13:05:17 2022 +0300
@@ -217,12 +217,18 @@
 #
 # 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
     data = {}
     for b in repo.branchmap().iterbranches():
         if b':' in b[0]:
             continue
         oldheads = [repo[n].rev() for n in b[1]]
-        newheads = _filter_obsolete_heads(repo, oldheads)
+        newheads = filterfn(repo, oldheads)
         data[b[0]] = newheads
     return data