mercurial/changelog.py
changeset 46780 6266d19556ad
parent 46714 f63299ee7e4d
child 46819 d4ba4d51f85f
equal deleted inserted replaced
46779:49fd21f32695 46780:6266d19556ad
   189 @attr.s
   189 @attr.s
   190 class _changelogrevision(object):
   190 class _changelogrevision(object):
   191     # Extensions might modify _defaultextra, so let the constructor below pass
   191     # Extensions might modify _defaultextra, so let the constructor below pass
   192     # it in
   192     # it in
   193     extra = attr.ib()
   193     extra = attr.ib()
   194     manifest = attr.ib(default=nullid)
   194     manifest = attr.ib()
   195     user = attr.ib(default=b'')
   195     user = attr.ib(default=b'')
   196     date = attr.ib(default=(0, 0))
   196     date = attr.ib(default=(0, 0))
   197     files = attr.ib(default=attr.Factory(list))
   197     files = attr.ib(default=attr.Factory(list))
   198     filesadded = attr.ib(default=None)
   198     filesadded = attr.ib(default=None)
   199     filesremoved = attr.ib(default=None)
   199     filesremoved = attr.ib(default=None)
   217         '_sidedata',
   217         '_sidedata',
   218         '_cpsd',
   218         '_cpsd',
   219         '_changes',
   219         '_changes',
   220     )
   220     )
   221 
   221 
   222     def __new__(cls, text, sidedata, cpsd):
   222     def __new__(cls, cl, text, sidedata, cpsd):
   223         if not text:
   223         if not text:
   224             return _changelogrevision(extra=_defaultextra)
   224             return _changelogrevision(extra=_defaultextra, manifest=nullid)
   225 
   225 
   226         self = super(changelogrevision, cls).__new__(cls)
   226         self = super(changelogrevision, cls).__new__(cls)
   227         # We could return here and implement the following as an __init__.
   227         # We could return here and implement the following as an __init__.
   228         # But doing it here is equivalent and saves an extra function call.
   228         # But doing it here is equivalent and saves an extra function call.
   229 
   229 
   524         ``changelogrevision`` instead, as it is faster for partial object
   524         ``changelogrevision`` instead, as it is faster for partial object
   525         access.
   525         access.
   526         """
   526         """
   527         d, s = self._revisiondata(nodeorrev)
   527         d, s = self._revisiondata(nodeorrev)
   528         c = changelogrevision(
   528         c = changelogrevision(
   529             d, s, self._copiesstorage == b'changeset-sidedata'
   529             self, d, s, self._copiesstorage == b'changeset-sidedata'
   530         )
   530         )
   531         return (c.manifest, c.user, c.date, c.files, c.description, c.extra)
   531         return (c.manifest, c.user, c.date, c.files, c.description, c.extra)
   532 
   532 
   533     def changelogrevision(self, nodeorrev):
   533     def changelogrevision(self, nodeorrev):
   534         """Obtain a ``changelogrevision`` for a node or revision."""
   534         """Obtain a ``changelogrevision`` for a node or revision."""
   535         text, sidedata = self._revisiondata(nodeorrev)
   535         text, sidedata = self._revisiondata(nodeorrev)
   536         return changelogrevision(
   536         return changelogrevision(
   537             text, sidedata, self._copiesstorage == b'changeset-sidedata'
   537             self, text, sidedata, self._copiesstorage == b'changeset-sidedata'
   538         )
   538         )
   539 
   539 
   540     def readfiles(self, nodeorrev):
   540     def readfiles(self, nodeorrev):
   541         """
   541         """
   542         short version of read that only returns the files modified by the cset
   542         short version of read that only returns the files modified by the cset