mercurial/logcmdutil.py
changeset 51287 f15cb5111a1e
parent 51285 9d3721552b6c
child 51290 f4a0806081f2
equal deleted inserted replaced
51286:81224afd938d 51287:f15cb5111a1e
   787 
   787 
   788     # limit number of changes displayed; None means unlimited
   788     # limit number of changes displayed; None means unlimited
   789     limit = attr.ib(default=None)
   789     limit = attr.ib(default=None)
   790 
   790 
   791 
   791 
   792 def parseopts(ui, pats, opts):
   792 def parseopts(
   793     # type: (Any, Sequence[bytes], Dict[bytes, Any]) -> walkopts
   793     ui: Any,
       
   794     pats: Sequence[bytes],
       
   795     opts: Dict[bytes, Any],
       
   796 ) -> walkopts:
   794     """Parse log command options into walkopts
   797     """Parse log command options into walkopts
   795 
   798 
   796     The returned walkopts will be passed in to getrevs() or makewalker().
   799     The returned walkopts will be passed in to getrevs() or makewalker().
   797     """
   800     """
   798     if opts.get(b'follow_first'):
   801     if opts.get(b'follow_first'):
  1078         revs = smartset.spanset(repo)
  1081         revs = smartset.spanset(repo)
  1079         revs.reverse()
  1082         revs.reverse()
  1080     return revs
  1083     return revs
  1081 
  1084 
  1082 
  1085 
  1083 def makewalker(repo, wopts):
  1086 def makewalker(
  1084     # type: (Any, walkopts) -> Tuple[smartset.abstractsmartset, Optional[Callable[[Any], matchmod.basematcher]]]
  1087     repo: Any,
       
  1088     wopts: walkopts,
       
  1089 ) -> Tuple[
       
  1090     smartset.abstractsmartset, Optional[Callable[[Any], matchmod.basematcher]]
       
  1091 ]:
  1085     """Build (revs, makefilematcher) to scan revision/file history
  1092     """Build (revs, makefilematcher) to scan revision/file history
  1086 
  1093 
  1087     - revs is the smartset to be traversed.
  1094     - revs is the smartset to be traversed.
  1088     - makefilematcher is a function to map ctx to a matcher for that revision
  1095     - makefilematcher is a function to map ctx to a matcher for that revision
  1089     """
  1096     """
  1129         revs = revs.slice(0, wopts.limit)
  1136         revs = revs.slice(0, wopts.limit)
  1130 
  1137 
  1131     return revs, filematcher
  1138     return revs, filematcher
  1132 
  1139 
  1133 
  1140 
  1134 def getrevs(repo, wopts):
  1141 def getrevs(
  1135     # type: (Any, walkopts) -> Tuple[smartset.abstractsmartset, Optional[changesetdiffer]]
  1142     repo: Any,
       
  1143     wopts: walkopts,
       
  1144 ) -> Tuple[smartset.abstractsmartset, Optional[changesetdiffer]]:
  1136     """Return (revs, differ) where revs is a smartset
  1145     """Return (revs, differ) where revs is a smartset
  1137 
  1146 
  1138     differ is a changesetdiffer with pre-configured file matcher.
  1147     differ is a changesetdiffer with pre-configured file matcher.
  1139     """
  1148     """
  1140     revs, filematcher = makewalker(repo, wopts)
  1149     revs, filematcher = makewalker(repo, wopts)