hgext/fastannotate/context.py
changeset 41261 1198c86beb73
parent 40839 dd1006874a5a
child 42947 0152a907f714
equal deleted inserted replaced
41260:c146651a78e1 41261:1198c86beb73
   600         """like annotate, but when we know that f is in linelog.
   600         """like annotate, but when we know that f is in linelog.
   601         f can be either a 20-char str (node) or a fctx. this is for perf - in
   601         f can be either a 20-char str (node) or a fctx. this is for perf - in
   602         the best case, the user provides a node and we don't need to read the
   602         the best case, the user provides a node and we don't need to read the
   603         filelog or construct any filecontext.
   603         filelog or construct any filecontext.
   604         """
   604         """
   605         if isinstance(f, str):
   605         if isinstance(f, bytes):
   606             hsh = f
   606             hsh = f
   607         else:
   607         else:
   608             hsh = f.node()
   608             hsh = f.node()
   609         llrev = self.revmap.hsh2rev(hsh)
   609         llrev = self.revmap.hsh2rev(hsh)
   610         if not llrev:
   610         if not llrev:
   623         f could be either node or fctx.
   623         f could be either node or fctx.
   624         """
   624         """
   625         if showpath:
   625         if showpath:
   626             result = self._addpathtoresult(result)
   626             result = self._addpathtoresult(result)
   627         if showlines:
   627         if showlines:
   628             if isinstance(f, str): # f: node or fctx
   628             if isinstance(f, bytes): # f: node or fctx
   629                 llrev = self.revmap.hsh2rev(f)
   629                 llrev = self.revmap.hsh2rev(f)
   630                 fctx = self._resolvefctx(f, self.revmap.rev2path(llrev))
   630                 fctx = self._resolvefctx(f, self.revmap.rev2path(llrev))
   631             else:
   631             else:
   632                 fctx = f
   632                 fctx = f
   633             lines = mdiff.splitnewlines(fctx.data())
   633             lines = mdiff.splitnewlines(fctx.data())