diff mercurial/bundle2.py @ 45552:10284ce3d5ed

scmutil: introduce function to check whether repo uses treemanifest or not In an upcoming patch, I wanted to check whether current repo uses treemanifest or not. I looked for a function and found that at all places we manually check for the requirement in repo requirements. I guess having a dedicated function for that is much better. Differential Revision: https://phab.mercurial-scm.org/D8981
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 01 Sep 2020 18:08:24 +0530
parents 77b8588dd84e
children d2e1dcd4490d
line wrap: on
line diff
--- a/mercurial/bundle2.py	Thu Sep 03 11:07:47 2020 -0400
+++ b/mercurial/bundle2.py	Tue Sep 01 18:08:24 2020 +0530
@@ -1964,10 +1964,7 @@
     nbchangesets = None
     if b'nbchanges' in inpart.params:
         nbchangesets = int(inpart.params.get(b'nbchanges'))
-    if (
-        b'treemanifest' in inpart.params
-        and requirements.TREEMANIFEST_REQUIREMENT not in op.repo.requirements
-    ):
+    if b'treemanifest' in inpart.params and not scmutil.istreemanifest(op.repo):
         if len(op.repo.changelog) != 0:
             raise error.Abort(
                 _(
@@ -2577,7 +2574,7 @@
 
         part = bundler.newpart(b'changegroup', data=cgdata)
         part.addparam(b'version', cgversion)
-        if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements:
+        if scmutil.istreemanifest(repo):
             part.addparam(b'treemanifest', b'1')
         if b'exp-sidedata-flag' in repo.requirements:
             part.addparam(b'exp-sidedata', b'1')