mercurial/logcmdutil.py
changeset 48014 0dc4cc654d96
parent 47437 7a430116f639
child 48116 5ced12cfa41b
equal deleted inserted replaced
48013:376d08ae904f 48014:0dc4cc654d96
    44 if pycompat.TYPE_CHECKING:
    44 if pycompat.TYPE_CHECKING:
    45     from typing import (
    45     from typing import (
    46         Any,
    46         Any,
    47         Callable,
    47         Callable,
    48         Dict,
    48         Dict,
    49         List,
       
    50         Optional,
    49         Optional,
    51         Sequence,
    50         Sequence,
    52         Tuple,
    51         Tuple,
    53     )
    52     )
    54 
    53 
    55     for t in (Any, Callable, Dict, List, Optional, Tuple):
    54     for t in (Any, Callable, Dict, Optional, Tuple):
    56         assert t
    55         assert t
    57 
    56 
    58 
    57 
    59 def getlimit(opts):
    58 def getlimit(opts):
    60     """get the log limit according to option -l/--limit"""
    59     """get the log limit according to option -l/--limit"""
   712     """Options to configure a set of revisions and file matcher factory
   711     """Options to configure a set of revisions and file matcher factory
   713     to scan revision/file history
   712     to scan revision/file history
   714     """
   713     """
   715 
   714 
   716     # raw command-line parameters, which a matcher will be built from
   715     # raw command-line parameters, which a matcher will be built from
   717     pats = attr.ib()  # type: List[bytes]
   716     pats = attr.ib()
   718     opts = attr.ib()  # type: Dict[bytes, Any]
   717     opts = attr.ib()
   719 
   718 
   720     # a list of revset expressions to be traversed; if follow, it specifies
   719     # a list of revset expressions to be traversed; if follow, it specifies
   721     # the start revisions
   720     # the start revisions
   722     revspec = attr.ib()  # type: List[bytes]
   721     revspec = attr.ib()
   723 
   722 
   724     # miscellaneous queries to filter revisions (see "hg help log" for details)
   723     # miscellaneous queries to filter revisions (see "hg help log" for details)
   725     bookmarks = attr.ib(default=attr.Factory(list))  # type: List[bytes]
   724     bookmarks = attr.ib(default=attr.Factory(list))
   726     branches = attr.ib(default=attr.Factory(list))  # type: List[bytes]
   725     branches = attr.ib(default=attr.Factory(list))
   727     date = attr.ib(default=None)  # type: Optional[bytes]
   726     date = attr.ib(default=None)
   728     keywords = attr.ib(default=attr.Factory(list))  # type: List[bytes]
   727     keywords = attr.ib(default=attr.Factory(list))
   729     no_merges = attr.ib(default=False)  # type: bool
   728     no_merges = attr.ib(default=False)
   730     only_merges = attr.ib(default=False)  # type: bool
   729     only_merges = attr.ib(default=False)
   731     prune_ancestors = attr.ib(default=attr.Factory(list))  # type: List[bytes]
   730     prune_ancestors = attr.ib(default=attr.Factory(list))
   732     users = attr.ib(default=attr.Factory(list))  # type: List[bytes]
   731     users = attr.ib(default=attr.Factory(list))
   733 
   732 
   734     # miscellaneous matcher arguments
   733     # miscellaneous matcher arguments
   735     include_pats = attr.ib(default=attr.Factory(list))  # type: List[bytes]
   734     include_pats = attr.ib(default=attr.Factory(list))
   736     exclude_pats = attr.ib(default=attr.Factory(list))  # type: List[bytes]
   735     exclude_pats = attr.ib(default=attr.Factory(list))
   737 
   736 
   738     # 0: no follow, 1: follow first, 2: follow both parents
   737     # 0: no follow, 1: follow first, 2: follow both parents
   739     follow = attr.ib(default=0)  # type: int
   738     follow = attr.ib(default=0)
   740 
   739 
   741     # do not attempt filelog-based traversal, which may be fast but cannot
   740     # do not attempt filelog-based traversal, which may be fast but cannot
   742     # include revisions where files were removed
   741     # include revisions where files were removed
   743     force_changelog_traversal = attr.ib(default=False)  # type: bool
   742     force_changelog_traversal = attr.ib(default=False)
   744 
   743 
   745     # filter revisions by file patterns, which should be disabled only if
   744     # filter revisions by file patterns, which should be disabled only if
   746     # you want to include revisions where files were unmodified
   745     # you want to include revisions where files were unmodified
   747     filter_revisions_by_pats = attr.ib(default=True)  # type: bool
   746     filter_revisions_by_pats = attr.ib(default=True)
   748 
   747 
   749     # sort revisions prior to traversal: 'desc', 'topo', or None
   748     # sort revisions prior to traversal: 'desc', 'topo', or None
   750     sort_revisions = attr.ib(default=None)  # type: Optional[bytes]
   749     sort_revisions = attr.ib(default=None)
   751 
   750 
   752     # limit number of changes displayed; None means unlimited
   751     # limit number of changes displayed; None means unlimited
   753     limit = attr.ib(default=None)  # type: Optional[int]
   752     limit = attr.ib(default=None)
   754 
   753 
   755 
   754 
   756 def parseopts(ui, pats, opts):
   755 def parseopts(ui, pats, opts):
   757     # type: (Any, Sequence[bytes], Dict[bytes, Any]) -> walkopts
   756     # type: (Any, Sequence[bytes], Dict[bytes, Any]) -> walkopts
   758     """Parse log command options into walkopts
   757     """Parse log command options into walkopts