hgext/fastannotate/context.py
changeset 48913 f254fc73d956
parent 48875 6000f5b25c9b
child 48946 642e31cb55f0
equal deleted inserted replaced
48912:a0674e916fb6 48913:f254fc73d956
   172         b'followmerge': True,
   172         b'followmerge': True,
   173     }
   173     }
   174 
   174 
   175     def __init__(self, **opts):
   175     def __init__(self, **opts):
   176         opts = pycompat.byteskwargs(opts)
   176         opts = pycompat.byteskwargs(opts)
   177         for k, v in pycompat.iteritems(self.defaults):
   177         for k, v in self.defaults.items():
   178             setattr(self, k, opts.get(k, v))
   178             setattr(self, k, opts.get(k, v))
   179 
   179 
   180     @util.propertycache
   180     @util.propertycache
   181     def shortstr(self):
   181     def shortstr(self):
   182         """represent opts in a short string, suitable for a directory name"""
   182         """represent opts in a short string, suitable for a directory name"""
   581             key2idxs[(revs[i], annotateresult[i][1])].append(i)
   581             key2idxs[(revs[i], annotateresult[i][1])].append(i)
   582         while key2idxs:
   582         while key2idxs:
   583             # find an unresolved line and its linelog rev to annotate
   583             # find an unresolved line and its linelog rev to annotate
   584             hsh = None
   584             hsh = None
   585             try:
   585             try:
   586                 for (rev, _linenum), idxs in pycompat.iteritems(key2idxs):
   586                 for (rev, _linenum), idxs in key2idxs.items():
   587                     if revmap.rev2flag(rev) & revmapmod.sidebranchflag:
   587                     if revmap.rev2flag(rev) & revmapmod.sidebranchflag:
   588                         continue
   588                         continue
   589                     hsh = annotateresult[idxs[0]][0]
   589                     hsh = annotateresult[idxs[0]][0]
   590                     break
   590                     break
   591             except StopIteration:  # no more unresolved lines
   591             except StopIteration:  # no more unresolved lines
   592                 return result
   592                 return result
   593             if hsh is None:
   593             if hsh is None:
   594                 # the remaining key2idxs are not in main branch, resolving them
   594                 # the remaining key2idxs are not in main branch, resolving them
   595                 # using the hard way...
   595                 # using the hard way...
   596                 revlines = {}
   596                 revlines = {}
   597                 for (rev, linenum), idxs in pycompat.iteritems(key2idxs):
   597                 for (rev, linenum), idxs in key2idxs.items():
   598                     if rev not in revlines:
   598                     if rev not in revlines:
   599                         hsh = annotateresult[idxs[0]][0]
   599                         hsh = annotateresult[idxs[0]][0]
   600                         if self.ui.debugflag:
   600                         if self.ui.debugflag:
   601                             self.ui.debug(
   601                             self.ui.debug(
   602                                 b'fastannotate: reading %s line #%d '
   602                                 b'fastannotate: reading %s line #%d '