##// END OF EJS Templates
annotate: simplify annotate parent function...
Durham Goode -
r19292:e0aa6fff default
parent child Browse files
Show More
@@ -45,6 +45,11 def perfwalk(ui, repo, *pats):
45 except Exception:
45 except Exception:
46 timer(lambda: len(list(cmdutil.walk(repo, pats, {}))))
46 timer(lambda: len(list(cmdutil.walk(repo, pats, {}))))
47
47
48 @command('perfannotate')
49 def perfannotate(ui, repo, f):
50 fc = repo['.'][f]
51 timer(lambda: len(fc.annotate(True)))
52
48 @command('perfstatus',
53 @command('perfstatus',
49 [('u', 'unknown', False,
54 [('u', 'unknown', False,
50 'ask status to look for unknown files')])
55 'ask status to look for unknown files')])
@@ -649,25 +649,21 class filectx(object):
649 return child
649 return child
650
650
651 getlog = util.lrucachefunc(lambda x: self._repo.file(x))
651 getlog = util.lrucachefunc(lambda x: self._repo.file(x))
652 def getctx(path, fileid):
653 log = path == self._path and self._filelog or getlog(path)
654 return filectx(self._repo, path, fileid=fileid, filelog=log)
655 getctx = util.lrucachefunc(getctx)
656
652
657 def parents(f):
653 def parents(f):
658 # we want to reuse filectx objects as much as possible
654 pl = f.parents()
659 p = f._path
655
660 if f._filerev is None: # working dir
656 # Don't return renamed parents if we aren't following.
661 pl = [(n.path(), n.filerev()) for n in f.parents()]
657 if not follow:
662 else:
658 pl = [p for p in pl if p.path() == f.path()]
663 pl = [(p, n) for n in f._filelog.parentrevs(f._filerev)]
664
659
665 if follow:
660 # renamed filectx won't have a filelog yet, so set it
666 r = f.renamed()
661 # from the cache to save time
667 if r:
662 for p in pl:
668 pl[0] = (r[0], getlog(r[0]).rev(r[1]))
663 if not '_filelog' in p.__dict__:
664 p._filelog = getlog(p.path())
669
665
670 return [getctx(p, n) for p, n in pl if n != nullrev]
666 return pl
671
667
672 # use linkrev to find the first changeset where self appeared
668 # use linkrev to find the first changeset where self appeared
673 if self.rev() != self.linkrev():
669 if self.rev() != self.linkrev():
General Comments 0
You need to be logged in to leave comments. Login now