Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 19611:bae0493b6dc0
basefilectx: move copies from filectx
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Sun, 11 Aug 2013 23:06:10 -0500 |
parents | 0670422d58c6 |
children | df54cc67b91b |
comparison
equal
deleted
inserted
replaced
19610:0670422d58c6 | 19611:bae0493b6dc0 |
---|---|
720 if not visit: | 720 if not visit: |
721 break | 721 break |
722 c = visit.pop(max(visit)) | 722 c = visit.pop(max(visit)) |
723 yield c | 723 yield c |
724 | 724 |
725 def copies(self, c2): | |
726 if not util.safehasattr(self, "_copycache"): | |
727 self._copycache = {} | |
728 sc2 = str(c2) | |
729 if sc2 not in self._copycache: | |
730 self._copycache[sc2] = copies.pathcopies(c2) | |
731 return self._copycache[sc2] | |
732 | |
725 class filectx(basefilectx): | 733 class filectx(basefilectx): |
726 """A filecontext object makes access to data related to a particular | 734 """A filecontext object makes access to data related to a particular |
727 filerevision convenient.""" | 735 filerevision convenient.""" |
728 def __init__(self, repo, path, changeid=None, fileid=None, | 736 def __init__(self, repo, path, changeid=None, fileid=None, |
729 filelog=None, changectx=None): | 737 filelog=None, changectx=None): |
810 def children(self): | 818 def children(self): |
811 # hard for renames | 819 # hard for renames |
812 c = self._filelog.children(self._filenode) | 820 c = self._filelog.children(self._filenode) |
813 return [filectx(self._repo, self._path, fileid=x, | 821 return [filectx(self._repo, self._path, fileid=x, |
814 filelog=self._filelog) for x in c] | 822 filelog=self._filelog) for x in c] |
815 | |
816 def copies(self, c2): | |
817 if not util.safehasattr(self, "_copycache"): | |
818 self._copycache = {} | |
819 sc2 = str(c2) | |
820 if sc2 not in self._copycache: | |
821 self._copycache[sc2] = copies.pathcopies(c2) | |
822 return self._copycache[sc2] | |
823 | 823 |
824 class workingctx(basectx): | 824 class workingctx(basectx): |
825 """A workingctx object makes access to data related to | 825 """A workingctx object makes access to data related to |
826 the current working directory convenient. | 826 the current working directory convenient. |
827 date - any valid date string or (unixtime, offset), or None. | 827 date - any valid date string or (unixtime, offset), or None. |