comparison mercurial/templatekw.py @ 38555:f2f9bacf0587

manifest: define and implement rev() on manifestlog Various code is accessing repo.manifestlog._revlog - a private attribute. This bypasses our interface and makes it difficult to implement non-revlog manifest storage. This commit adds a rev() method to the manifestlog interface and class and teaches callers to use it. Ideally this method wouldn't exist, as very few consumers should need to resolve the revision number of a manifest. Again, the primary goal of interface work is to establish and use interfaces first and to improve them later. Differential Revision: https://phab.mercurial-scm.org/D3882
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 04 Jul 2018 12:12:49 -0700
parents 4455e5d4d59c
children 64f15e22f4f8
comparison
equal deleted inserted replaced
38554:f83600efa1ca 38555:f2f9bacf0587
463 ctx = context.resource(mapping, 'ctx') 463 ctx = context.resource(mapping, 'ctx')
464 mnode = ctx.manifestnode() 464 mnode = ctx.manifestnode()
465 if mnode is None: 465 if mnode is None:
466 # just avoid crash, we might want to use the 'ff...' hash in future 466 # just avoid crash, we might want to use the 'ff...' hash in future
467 return 467 return
468 mrev = repo.manifestlog._revlog.rev(mnode) 468 mrev = repo.manifestlog.rev(mnode)
469 mhex = hex(mnode) 469 mhex = hex(mnode)
470 mapping = context.overlaymap(mapping, {'rev': mrev, 'node': mhex}) 470 mapping = context.overlaymap(mapping, {'rev': mrev, 'node': mhex})
471 f = context.process('manifest', mapping) 471 f = context.process('manifest', mapping)
472 # TODO: perhaps 'ctx' should be dropped from mapping because manifest 472 # TODO: perhaps 'ctx' should be dropped from mapping because manifest
473 # rev and node are completely different from changeset's. 473 # rev and node are completely different from changeset's.