Mercurial > hg-stable
changeset 19610:0670422d58c6
basefilectx: move ancestors from filectx
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Sun, 11 Aug 2013 23:05:50 -0500 |
parents | 4e72ffec8c2d |
children | bae0493b6dc0 |
files | mercurial/context.py |
diffstat | 1 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Sun Aug 11 23:05:08 2013 -0500 +++ b/mercurial/context.py Sun Aug 11 23:05:50 2013 -0500 @@ -710,6 +710,18 @@ return None + def ancestors(self, followfirst=False): + visit = {} + c = self + cut = followfirst and 1 or None + while True: + for parent in c.parents()[:cut]: + visit[(parent.rev(), parent.node())] = parent + if not visit: + break + c = visit.pop(max(visit)) + yield c + class filectx(basefilectx): """A filecontext object makes access to data related to a particular filerevision convenient.""" @@ -801,18 +813,6 @@ return [filectx(self._repo, self._path, fileid=x, filelog=self._filelog) for x in c] - def ancestors(self, followfirst=False): - visit = {} - c = self - cut = followfirst and 1 or None - while True: - for parent in c.parents()[:cut]: - visit[(parent.rev(), parent.node())] = parent - if not visit: - break - c = visit.pop(max(visit)) - yield c - def copies(self, c2): if not util.safehasattr(self, "_copycache"): self._copycache = {}