comparison mercurial/commands.py @ 41368:609d6d8646db

grep: use set instead of dict with dummy value Differential Revision: https://phab.mercurial-scm.org/D5633
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 18 Jan 2019 11:10:30 -0800
parents b44f1703b28c
children 2f2a7ea62e9a
comparison
equal deleted inserted replaced
41367:b44f1703b28c 41368:609d6d8646db
2923 fm.startitem() 2923 fm.startitem()
2924 fm.write('text', '%s', l.line[p:]) 2924 fm.write('text', '%s', l.line[p:])
2925 fm.data(matched=False) 2925 fm.data(matched=False)
2926 fm.end() 2926 fm.end()
2927 2927
2928 skip = {} 2928 skip = set()
2929 revfiles = {} 2929 revfiles = {}
2930 match = scmutil.match(repo[None], pats, opts) 2930 match = scmutil.match(repo[None], pats, opts)
2931 found = False 2931 found = False
2932 follow = opts.get('follow') 2932 follow = opts.get('follow')
2933 2933
2952 copied = ctx[fn].renamed() 2952 copied = ctx[fn].renamed()
2953 copy = copied and copied[0] 2953 copy = copied and copied[0]
2954 if copy: 2954 if copy:
2955 copies.setdefault(rev, {})[fn] = copy 2955 copies.setdefault(rev, {})[fn] = copy
2956 if fn in skip: 2956 if fn in skip:
2957 skip[copy] = True 2957 skip.add(copy)
2958 if fn in skip: 2958 if fn in skip:
2959 continue 2959 continue
2960 files.append(fn) 2960 files.append(fn)
2961 2961
2962 if fn not in matches[rev]: 2962 if fn not in matches[rev]:
2982 for fn in sorted(revfiles.get(rev, [])): 2982 for fn in sorted(revfiles.get(rev, [])):
2983 states = matches[rev][fn] 2983 states = matches[rev][fn]
2984 copy = copies.get(rev, {}).get(fn) 2984 copy = copies.get(rev, {}).get(fn)
2985 if fn in skip: 2985 if fn in skip:
2986 if copy: 2986 if copy:
2987 skip[copy] = True 2987 skip.add(copy)
2988 continue 2988 continue
2989 pstates = matches.get(parent, {}).get(copy or fn, []) 2989 pstates = matches.get(parent, {}).get(copy or fn, [])
2990 if pstates or states: 2990 if pstates or states:
2991 r = display(fm, fn, ctx, pstates, states) 2991 r = display(fm, fn, ctx, pstates, states)
2992 found = found or r 2992 found = found or r
2993 if r and not diff and not all_files: 2993 if r and not diff and not all_files:
2994 skip[fn] = True 2994 skip.add(fn)
2995 if copy: 2995 if copy:
2996 skip[copy] = True 2996 skip.add(copy)
2997 del revfiles[rev] 2997 del revfiles[rev]
2998 # We will keep the matches dict for the duration of the window 2998 # We will keep the matches dict for the duration of the window
2999 # clear the matches dict once the window is over 2999 # clear the matches dict once the window is over
3000 if not revfiles: 3000 if not revfiles:
3001 matches.clear() 3001 matches.clear()