# HG changeset patch # User Yuya Nishihara # Date 1514879917 -32400 # Node ID e64baf32782ad41eacf61c25ce9b4ca543285283 # Parent c41bb85c09ff472adfefd038e63adbec9a74c711 log: make opt2revset table a module constant Just makes it clear that the table isn't updated in _makelogrevset(). diff -r c41bb85c09ff -r e64baf32782a mercurial/cmdutil.py --- a/mercurial/cmdutil.py Sun Jan 14 13:04:26 2018 -0800 +++ b/mercurial/cmdutil.py Tue Jan 02 16:58:37 2018 +0900 @@ -2338,6 +2338,24 @@ '''hook for extensions to override the filematcher for non-follow cases''' return None +_opt2logrevset = { + 'no_merges': ('not merge()', None), + 'only_merges': ('merge()', None), + '_ancestors': ('ancestors(%(val)s)', None), + '_fancestors': ('_firstancestors(%(val)s)', None), + '_descendants': ('descendants(%(val)s)', None), + '_fdescendants': ('_firstdescendants(%(val)s)', None), + '_matchfiles': ('_matchfiles(%(val)s)', None), + 'date': ('date(%(val)r)', None), + 'branch': ('branch(%(val)r)', ' or '), + '_patslog': ('filelog(%(val)r)', ' or '), + '_patsfollow': ('follow(%(val)r)', ' or '), + '_patsfollowfirst': ('_followfirst(%(val)r)', ' or '), + 'keyword': ('keyword(%(val)r)', ' or '), + 'prune': ('not (%(val)r or ancestors(%(val)r))', ' and '), + 'user': ('user(%(val)r)', ' or '), +} + def _makelogrevset(repo, pats, opts, revs): """Return (expr, filematcher) where expr is a revset string built from log options and file patterns or None. If --stat or --patch @@ -2345,24 +2363,6 @@ taking a revision number and returning a match objects filtering the files to be detailed when displaying the revision. """ - opt2revset = { - 'no_merges': ('not merge()', None), - 'only_merges': ('merge()', None), - '_ancestors': ('ancestors(%(val)s)', None), - '_fancestors': ('_firstancestors(%(val)s)', None), - '_descendants': ('descendants(%(val)s)', None), - '_fdescendants': ('_firstdescendants(%(val)s)', None), - '_matchfiles': ('_matchfiles(%(val)s)', None), - 'date': ('date(%(val)r)', None), - 'branch': ('branch(%(val)r)', ' or '), - '_patslog': ('filelog(%(val)r)', ' or '), - '_patsfollow': ('follow(%(val)r)', ' or '), - '_patsfollowfirst': ('_followfirst(%(val)r)', ' or '), - 'keyword': ('keyword(%(val)r)', ' or '), - 'prune': ('not (%(val)r or ancestors(%(val)r))', ' and '), - 'user': ('user(%(val)r)', ' or '), - } - opts = dict(opts) # follow or not follow? follow = opts.get('follow') or opts.get('follow_first') @@ -2471,9 +2471,9 @@ for op, val in sorted(opts.iteritems()): if not val: continue - if op not in opt2revset: + if op not in _opt2logrevset: continue - revop, andor = opt2revset[op] + revop, andor = _opt2logrevset[op] if '%(val)' not in revop: expr.append(revop) else: