comparison mercurial/context.py @ 29939:80be4436e4cc

manifest: adds manifestctx.readfast This adds a copy of manifest.readfast to manifestctx.readfast and adds a consumer of it. It currently looks like duplicate code, but a future patch causes these functions to diverge as tree concepts are added to the tree version.
author Durham Goode <durham@fb.com>
date Tue, 13 Sep 2016 16:26:30 -0700
parents a059b17352ef
children ff17dff99295
comparison
equal deleted inserted replaced
29938:a059b17352ef 29939:80be4436e4cc
822 :srcrev: the changeset revision we search ancestors from 822 :srcrev: the changeset revision we search ancestors from
823 :inclusive: if true, the src revision will also be checked 823 :inclusive: if true, the src revision will also be checked
824 """ 824 """
825 repo = self._repo 825 repo = self._repo
826 cl = repo.unfiltered().changelog 826 cl = repo.unfiltered().changelog
827 ma = repo.manifest 827 mfl = repo.manifestlog
828 # fetch the linkrev 828 # fetch the linkrev
829 fr = filelog.rev(fnode) 829 fr = filelog.rev(fnode)
830 lkr = filelog.linkrev(fr) 830 lkr = filelog.linkrev(fr)
831 # hack to reuse ancestor computation when searching for renames 831 # hack to reuse ancestor computation when searching for renames
832 memberanc = getattr(self, '_ancestrycontext', None) 832 memberanc = getattr(self, '_ancestrycontext', None)
847 for a in iteranc: 847 for a in iteranc:
848 ac = cl.read(a) # get changeset data (we avoid object creation) 848 ac = cl.read(a) # get changeset data (we avoid object creation)
849 if path in ac[3]: # checking the 'files' field. 849 if path in ac[3]: # checking the 'files' field.
850 # The file has been touched, check if the content is 850 # The file has been touched, check if the content is
851 # similar to the one we search for. 851 # similar to the one we search for.
852 if fnode == ma.readfast(ac[0]).get(path): 852 if fnode == mfl[ac[0]].readfast().get(path):
853 return a 853 return a
854 # In theory, we should never get out of that loop without a result. 854 # In theory, we should never get out of that loop without a result.
855 # But if manifest uses a buggy file revision (not children of the 855 # But if manifest uses a buggy file revision (not children of the
856 # one it replaces) we could. Such a buggy situation will likely 856 # one it replaces) we could. Such a buggy situation will likely
857 # result is crash somewhere else at to some point. 857 # result is crash somewhere else at to some point.