##// END OF EJS Templates
log: parse --limit option by logcmdutil.parseopts()
Yuya Nishihara -
r46141:bddf70c9 default
parent child Browse files
Show More
@@ -689,6 +689,9 b' class walkopts(object):'
689 # 0: no follow, 1: follow first, 2: follow both parents
689 # 0: no follow, 1: follow first, 2: follow both parents
690 follow = attr.ib(default=0) # type: int
690 follow = attr.ib(default=0) # type: int
691
691
692 # limit number of changes displayed; None means unlimited
693 limit = attr.ib(default=None) # type: Optional[int]
694
692
695
693 def parseopts(ui, pats, opts):
696 def parseopts(ui, pats, opts):
694 # type: (Any, List[bytes], Dict[bytes, Any]) -> walkopts
697 # type: (Any, List[bytes], Dict[bytes, Any]) -> walkopts
@@ -703,7 +706,7 b' def parseopts(ui, pats, opts):'
703 else:
706 else:
704 follow = 0
707 follow = 0
705
708
706 return walkopts(pats=pats, opts=opts, follow=follow)
709 return walkopts(pats=pats, opts=opts, follow=follow, limit=getlimit(opts))
707
710
708
711
709 def _makematcher(repo, revs, wopts):
712 def _makematcher(repo, revs, wopts):
@@ -907,7 +910,6 b' def getrevs(repo, wopts):'
907
910
908 differ is a changesetdiffer with pre-configured file matcher.
911 differ is a changesetdiffer with pre-configured file matcher.
909 """
912 """
910 limit = getlimit(wopts.opts)
911 revs = _initialrevs(repo, wopts)
913 revs = _initialrevs(repo, wopts)
912 if not revs:
914 if not revs:
913 return smartset.baseset(), None
915 return smartset.baseset(), None
@@ -943,8 +945,8 b' def getrevs(repo, wopts):'
943 if expr:
945 if expr:
944 matcher = revset.match(None, expr)
946 matcher = revset.match(None, expr)
945 revs = matcher(repo, revs)
947 revs = matcher(repo, revs)
946 if limit is not None:
948 if wopts.limit is not None:
947 revs = revs.slice(0, limit)
949 revs = revs.slice(0, wopts.limit)
948
950
949 differ = changesetdiffer()
951 differ = changesetdiffer()
950 differ._makefilematcher = filematcher
952 differ._makefilematcher = filematcher
General Comments 0
You need to be logged in to leave comments. Login now