comparison mercurial/cmdutil.py @ 39272:73cf21b2e8a6

manifest: add getstorage() to manifestlog and use it globally It is a common pattern to obtain a directory manifest storage instance (a manifestrevlog) by going through manifestlog._revlog.dirlog(). Why access to storage and caching of other manifests is done through manifestrevlog instead of manifestlog, I don't know. This commit establishes a getstorage(tree) API on manifestlog and imanifestlog that provides a public API for accessing manifest storage. All consumers previously using private attributes have been updated to use this new method. .. api:: manifestlog now has a getstorage(tree) method It should be used for obtaining an object representing the manifest's storage implementation. Accessing manifestlog._revlog should be avoided. Differential Revision: https://phab.mercurial-scm.org/D4277
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 10 Aug 2018 15:01:06 -0700
parents 1320df0dcaae
children 53e532007878
comparison
equal deleted inserted replaced
39271:0d97530eb535 39272:73cf21b2e8a6
1081 if 'treemanifest' not in repo.requirements: 1081 if 'treemanifest' not in repo.requirements:
1082 raise error.Abort(_("--dir can only be used on repos with " 1082 raise error.Abort(_("--dir can only be used on repos with "
1083 "treemanifest enabled")) 1083 "treemanifest enabled"))
1084 if not dir.endswith('/'): 1084 if not dir.endswith('/'):
1085 dir = dir + '/' 1085 dir = dir + '/'
1086 dirlog = repo.manifestlog._revlog.dirlog(dir) 1086 dirlog = repo.manifestlog.getstorage(dir)
1087 if len(dirlog): 1087 if len(dirlog):
1088 r = dirlog 1088 r = dirlog
1089 elif mf: 1089 elif mf:
1090 r = repo.manifestlog._revlog 1090 r = repo.manifestlog.getstorage(b'')
1091 elif file_: 1091 elif file_:
1092 filelog = repo.file(file_) 1092 filelog = repo.file(file_)
1093 if len(filelog): 1093 if len(filelog):
1094 r = filelog 1094 r = filelog
1095 if not r: 1095 if not r: