Mercurial > hg
diff mercurial/logcmdutil.py @ 45567:bddf70c93614
log: parse --limit option by logcmdutil.parseopts()
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 12 Sep 2020 21:39:58 +0900 |
parents | 24df19a9ab87 |
children | 9a26fea2b518 |
line wrap: on
line diff
--- 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