comparison mercurial/commands.py @ 1212:ccb6201e3f28

Change grep -e to grep --all We want to reserve -e for future use and grep compatibility. I've changed every-match to all out of a general preference for shorter long option names where short options don't exist.
author mpm@selenic.com
date Wed, 07 Sep 2005 20:50:23 -0700
parents 1c455338ad95
children 34706a835d4a
comparison
equal deleted inserted replaced
1211:1c455338ad95 1212:ccb6201e3f28
910 diff = list(sets.Set(states).symmetric_difference(sets.Set(prevstates))) 910 diff = list(sets.Set(states).symmetric_difference(sets.Set(prevstates)))
911 diff.sort(lambda x, y: cmp(x.linenum, y.linenum)) 911 diff.sort(lambda x, y: cmp(x.linenum, y.linenum))
912 counts = {'-': 0, '+': 0} 912 counts = {'-': 0, '+': 0}
913 filerevmatches = {} 913 filerevmatches = {}
914 for l in diff: 914 for l in diff:
915 if incrementing or not opts['every_match']: 915 if incrementing or not opts['all']:
916 change = ((l in prevstates) and '-') or '+' 916 change = ((l in prevstates) and '-') or '+'
917 r = rev 917 r = rev
918 else: 918 else:
919 change = ((l in states) and '-') or '+' 919 change = ((l in states) and '-') or '+'
920 r = prev[fn] 920 r = prev[fn]
921 cols = [fn, str(rev)] 921 cols = [fn, str(rev)]
922 if opts['line_number']: cols.append(str(l.linenum)) 922 if opts['line_number']: cols.append(str(l.linenum))
923 if opts['every_match']: cols.append(change) 923 if opts['all']: cols.append(change)
924 if opts['user']: cols.append(trimuser(ui, getchange(rev)[1], rev, 924 if opts['user']: cols.append(trimuser(ui, getchange(rev)[1], rev,
925 ucache)) 925 ucache))
926 if opts['files_with_matches']: 926 if opts['files_with_matches']:
927 c = (fn, rev) 927 c = (fn, rev)
928 if c in filerevmatches: continue 928 if c in filerevmatches: continue
955 elif st == 'iter': 955 elif st == 'iter':
956 states = matches[rev].items() 956 states = matches[rev].items()
957 states.sort() 957 states.sort()
958 for fn, m in states: 958 for fn, m in states:
959 if fn in skip: continue 959 if fn in skip: continue
960 if incrementing or not opts['every_match'] or fstate[fn]: 960 if incrementing or not opts['all'] or fstate[fn]:
961 pos, neg = display(fn, rev, m, fstate[fn]) 961 pos, neg = display(fn, rev, m, fstate[fn])
962 count += pos + neg 962 count += pos + neg
963 if pos and not opts['every_match']: 963 if pos and not opts['all']:
964 skip[fn] = True 964 skip[fn] = True
965 fstate[fn] = m 965 fstate[fn] = m
966 prev[fn] = rev 966 prev[fn] = rev
967 967
968 if not incrementing: 968 if not incrementing:
1664 "grep": 1664 "grep":
1665 (grep, 1665 (grep,
1666 [('0', 'print0', None, 'end fields with NUL'), 1666 [('0', 'print0', None, 'end fields with NUL'),
1667 ('I', 'include', [], 'include path in search'), 1667 ('I', 'include', [], 'include path in search'),
1668 ('X', 'exclude', [], 'include path in search'), 1668 ('X', 'exclude', [], 'include path in search'),
1669 ('e', 'every-match', None, 'print every rev with matches'), 1669 ('', 'all', None, 'print all revisions with matches'),
1670 ('i', 'ignore-case', None, 'ignore case when matching'), 1670 ('i', 'ignore-case', None, 'ignore case when matching'),
1671 ('l', 'files-with-matches', None, 'print names of files and revs with matches'), 1671 ('l', 'files-with-matches', None, 'print names of files and revs with matches'),
1672 ('n', 'line-number', None, 'print line numbers'), 1672 ('n', 'line-number', None, 'print line numbers'),
1673 ('r', 'rev', [], 'search in revision rev'), 1673 ('r', 'rev', [], 'search in revision rev'),
1674 ('u', 'user', None, 'print user who made change')], 1674 ('u', 'user', None, 'print user who made change')],