mercurial/context.py
changeset 3146 e69a0cbe268e
parent 3144 8342ad5abe0b
child 3149 ff1ab08e6732
equal deleted inserted replaced
3145:e4ea47c21480 3146:e69a0cbe268e
     5 # This software may be used and distributed according to the terms
     5 # This software may be used and distributed according to the terms
     6 # of the GNU General Public License, incorporated herein by reference.
     6 # of the GNU General Public License, incorporated herein by reference.
     7 
     7 
     8 from node import *
     8 from node import *
     9 from demandload import demandload
     9 from demandload import demandload
    10 demandload(globals(), "ancestor")
    10 demandload(globals(), "ancestor util")
    11 
    11 
    12 class changectx(object):
    12 class changectx(object):
    13     """A changecontext object makes access to data related to a particular
    13     """A changecontext object makes access to data related to a particular
    14     changeset convenient."""
    14     changeset convenient."""
    15     def __init__(self, repo, changeid=None):
    15     def __init__(self, repo, changeid=None):
   153         c = self._filelog.children(self._filenode)
   153         c = self._filelog.children(self._filenode)
   154         return [ filectx(self._repo, self._path, fileid=x,
   154         return [ filectx(self._repo, self._path, fileid=x,
   155                          filelog=self._filelog) for x in c ]
   155                          filelog=self._filelog) for x in c ]
   156 
   156 
   157     def annotate(self):
   157     def annotate(self):
   158         return self._filelog.annotate(self._filenode)
   158         getctx = util.cachefunc(lambda x: filectx(self._repo, self._path,
       
   159                                                   changeid=x,
       
   160                                                   filelog=self._filelog))
       
   161         hist = self._filelog.annotate(self._filenode)
       
   162 
       
   163         return [(getctx(rev), line) for rev, line in hist]
   159 
   164 
   160     def ancestor(self, fc2):
   165     def ancestor(self, fc2):
   161         """
   166         """
   162         find the common ancestor file context, if any, of self, and fc2
   167         find the common ancestor file context, if any, of self, and fc2
   163         """
   168         """