comparison mercurial/revlog.py @ 42980:0d1272783f24

revlog: introduce a `sidedata` method The method give access to extra information related to the revision. Such data will not be part of the hash be strongly related to the revision. Having them stored at the revlog level helps the storage consistency story and simplify various things. Example of data we could store there: - copy tracing related informations - graph structure related information (useful for discovery) - unresolved conflict data The full implementation will be introduced gradually in the coming changesets. Differential Revision: https://phab.mercurial-scm.org/D6808
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 03 Sep 2019 22:36:27 +0200
parents 4a3efe0febb5
children 35ab2c1a58aa
comparison
equal deleted inserted replaced
42979:b4093d1d3b18 42980:0d1272783f24
1614 msg = ('revlog.revision(..., raw=True) is deprecated, ' 1614 msg = ('revlog.revision(..., raw=True) is deprecated, '
1615 'use revlog.rawdata(...)') 1615 'use revlog.rawdata(...)')
1616 util.nouideprecwarn(msg, '5.2', stacklevel=2) 1616 util.nouideprecwarn(msg, '5.2', stacklevel=2)
1617 return self._revisiondata(nodeorrev, _df, raw=raw) 1617 return self._revisiondata(nodeorrev, _df, raw=raw)
1618 1618
1619 def sidedata(self, nodeorrev, _df=None):
1620 """a map of extra data related to the changeset but not part of the hash
1621
1622 This function currently return a dictionary. However, more advanced
1623 mapping object will likely be used in the future for a more
1624 efficient/lazy code.
1625 """
1626 # XXX will actualy return data once storage is implemented.
1627 return {}
1628
1619 def _revisiondata(self, nodeorrev, _df=None, raw=False): 1629 def _revisiondata(self, nodeorrev, _df=None, raw=False):
1620 # deal with <nodeorrev> argument type 1630 # deal with <nodeorrev> argument type
1621 if isinstance(nodeorrev, int): 1631 if isinstance(nodeorrev, int):
1622 rev = nodeorrev 1632 rev = nodeorrev
1623 node = self.node(rev) 1633 node = self.node(rev)