# HG changeset patch # User Yuya Nishihara # Date 1599914398 -32400 # Node ID bddf70c936148e30edd5be123ec28ca0976aba8f # Parent 24df19a9ab87c1f0553e04d12865561eeb4be912 log: parse --limit option by logcmdutil.parseopts() diff -r 24df19a9ab87 -r bddf70c93614 mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py Sat Sep 12 21:35:26 2020 +0900 +++ b/mercurial/logcmdutil.py Sat Sep 12 21:39:58 2020 +0900 @@ -689,6 +689,9 @@ # 0: no follow, 1: follow first, 2: follow both parents follow = attr.ib(default=0) # type: int + # limit number of changes displayed; None means unlimited + limit = attr.ib(default=None) # type: Optional[int] + def parseopts(ui, pats, opts): # type: (Any, List[bytes], Dict[bytes, Any]) -> walkopts @@ -703,7 +706,7 @@ else: follow = 0 - return walkopts(pats=pats, opts=opts, follow=follow) + return walkopts(pats=pats, opts=opts, follow=follow, limit=getlimit(opts)) def _makematcher(repo, revs, wopts): @@ -907,7 +910,6 @@ differ is a changesetdiffer with pre-configured file matcher. """ - limit = getlimit(wopts.opts) revs = _initialrevs(repo, wopts) if not revs: return smartset.baseset(), None @@ -943,8 +945,8 @@ if expr: matcher = revset.match(None, expr) revs = matcher(repo, revs) - if limit is not None: - revs = revs.slice(0, limit) + if wopts.limit is not None: + revs = revs.slice(0, wopts.limit) differ = changesetdiffer() differ._makefilematcher = filematcher