Show More
@@ -710,6 +710,18 b' class basefilectx(object):' | |||||
710 |
|
710 | |||
711 | return None |
|
711 | return None | |
712 |
|
712 | |||
|
713 | def ancestors(self, followfirst=False): | |||
|
714 | visit = {} | |||
|
715 | c = self | |||
|
716 | cut = followfirst and 1 or None | |||
|
717 | while True: | |||
|
718 | for parent in c.parents()[:cut]: | |||
|
719 | visit[(parent.rev(), parent.node())] = parent | |||
|
720 | if not visit: | |||
|
721 | break | |||
|
722 | c = visit.pop(max(visit)) | |||
|
723 | yield c | |||
|
724 | ||||
713 | class filectx(basefilectx): |
|
725 | class filectx(basefilectx): | |
714 | """A filecontext object makes access to data related to a particular |
|
726 | """A filecontext object makes access to data related to a particular | |
715 | filerevision convenient.""" |
|
727 | filerevision convenient.""" | |
@@ -801,18 +813,6 b' class filectx(basefilectx):' | |||||
801 | return [filectx(self._repo, self._path, fileid=x, |
|
813 | return [filectx(self._repo, self._path, fileid=x, | |
802 | filelog=self._filelog) for x in c] |
|
814 | filelog=self._filelog) for x in c] | |
803 |
|
815 | |||
804 | def ancestors(self, followfirst=False): |
|
|||
805 | visit = {} |
|
|||
806 | c = self |
|
|||
807 | cut = followfirst and 1 or None |
|
|||
808 | while True: |
|
|||
809 | for parent in c.parents()[:cut]: |
|
|||
810 | visit[(parent.rev(), parent.node())] = parent |
|
|||
811 | if not visit: |
|
|||
812 | break |
|
|||
813 | c = visit.pop(max(visit)) |
|
|||
814 | yield c |
|
|||
815 |
|
||||
816 | def copies(self, c2): |
|
816 | def copies(self, c2): | |
817 | if not util.safehasattr(self, "_copycache"): |
|
817 | if not util.safehasattr(self, "_copycache"): | |
818 | self._copycache = {} |
|
818 | self._copycache = {} |
General Comments 0
You need to be logged in to leave comments.
Login now