comparison mercurial/scmutil.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 9b16bb3b2349
children d2e1dcd4490d
comparison
equal deleted inserted replaced
45551:4c8d9b53b1c7 45552:10284ce3d5ed
1490 store.add(r) 1490 store.add(r)
1491 return wc, store 1491 return wc, store
1492 return requirements, None 1492 return requirements, None
1493 1493
1494 1494
1495 def istreemanifest(repo):
1496 """ returns whether the repository is using treemanifest or not """
1497 return requirementsmod.TREEMANIFEST_REQUIREMENT in repo.requirements
1498
1499
1495 def writereporequirements(repo, requirements=None): 1500 def writereporequirements(repo, requirements=None):
1496 """ writes requirements for the repo to .hg/requires """ 1501 """ writes requirements for the repo to .hg/requires """
1497 if requirements: 1502 if requirements:
1498 repo.requirements = requirements 1503 repo.requirements = requirements
1499 wcreq, storereq = filterrequirements(repo.requirements) 1504 wcreq, storereq = filterrequirements(repo.requirements)