This matches the config name to be added.
Note that we don't have to keep the old flag since it isn't released yet.
pulkit |
hg-reviewers |
This matches the config name to be added.
Note that we don't have to keep the old flag since it isn't released yet.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/cmdutil.py (5 lines) | |||
M | mercurial/commands.py (4 lines) | |||
M | tests/test-completion.t (2 lines) | |||
M | tests/test-grep.t (2 lines) |
We walk a window of revisions in the desired order. Within the | We walk a window of revisions in the desired order. Within the | ||||
window, we first walk forwards to gather data, then in the desired | window, we first walk forwards to gather data, then in the desired | ||||
order (usually backwards) to display it. | order (usually backwards) to display it. | ||||
This function returns an iterator yielding contexts. Before | This function returns an iterator yielding contexts. Before | ||||
yielding each context, the iterator will first call the prepare | yielding each context, the iterator will first call the prepare | ||||
function on each context in the window in forward order.''' | function on each context in the window in forward order.''' | ||||
allfiles = opts.get('allfiles') | allfiles = opts.get('all_files') | ||||
follow = opts.get('follow') or opts.get('follow_first') | follow = opts.get('follow') or opts.get('follow_first') | ||||
revs = _walkrevs(repo, opts) | revs = _walkrevs(repo, opts) | ||||
if not revs: | if not revs: | ||||
return [] | return [] | ||||
if allfiles and len(revs) > 1: | if allfiles and len(revs) > 1: | ||||
raise error.Abort(_("multiple revisions not supported with --allfiles")) | raise error.Abort(_("multiple revisions not supported with " | ||||
"--all-files")) | |||||
wanted = set() | wanted = set() | ||||
slowpath = match.anypats() or (not match.always() and opts.get('removed')) | slowpath = match.anypats() or (not match.always() and opts.get('removed')) | ||||
fncache = {} | fncache = {} | ||||
change = repo.__getitem__ | change = repo.__getitem__ | ||||
# First step is to fill wanted, the set of revisions that we want to yield. | # First step is to fill wanted, the set of revisions that we want to yield. | ||||
# When it does not induce extra cost, we also fill fncache for revisions in | # When it does not induce extra cost, we also fill fncache for revisions in | ||||
# wanted: a cache of filenames that were changed (ctx.files()) and that | # wanted: a cache of filenames that were changed (ctx.files()) and that |
_('follow changeset history,' | _('follow changeset history,' | ||||
' or file history across copies and renames')), | ' or file history across copies and renames')), | ||||
('i', 'ignore-case', None, _('ignore case when matching')), | ('i', 'ignore-case', None, _('ignore case when matching')), | ||||
('l', 'files-with-matches', None, | ('l', 'files-with-matches', None, | ||||
_('print only filenames and revisions that match')), | _('print only filenames and revisions that match')), | ||||
('n', 'line-number', None, _('print matching line numbers')), | ('n', 'line-number', None, _('print matching line numbers')), | ||||
('r', 'rev', [], | ('r', 'rev', [], | ||||
_('only search files changed within revision range'), _('REV')), | _('only search files changed within revision range'), _('REV')), | ||||
('', 'allfiles', False, | ('', 'all-files', False, | ||||
_('include all files in the changeset while grepping (EXPERIMENTAL)')), | _('include all files in the changeset while grepping (EXPERIMENTAL)')), | ||||
('u', 'user', None, _('list the author (long with -v)')), | ('u', 'user', None, _('list the author (long with -v)')), | ||||
('d', 'date', None, _('list the date (short with -q)')), | ('d', 'date', None, _('list the date (short with -q)')), | ||||
] + formatteropts + walkopts, | ] + formatteropts + walkopts, | ||||
_('[OPTION]... PATTERN [FILE]...'), | _('[OPTION]... PATTERN [FILE]...'), | ||||
inferrepo=True, | inferrepo=True, | ||||
intents={INTENT_READONLY}) | intents={INTENT_READONLY}) | ||||
def grep(ui, repo, pattern, *pats, **opts): | def grep(ui, repo, pattern, *pats, **opts): | ||||
ui.warn(_("grep: invalid match pattern: %s\n") % pycompat.bytestr(inst)) | ui.warn(_("grep: invalid match pattern: %s\n") % pycompat.bytestr(inst)) | ||||
return 1 | return 1 | ||||
sep, eol = ':', '\n' | sep, eol = ':', '\n' | ||||
if opts.get('print0'): | if opts.get('print0'): | ||||
sep = eol = '\0' | sep = eol = '\0' | ||||
if not opts.get('rev') and not diff: | if not opts.get('rev') and not diff: | ||||
opts['rev'] = ["wdir()"] | opts['rev'] = ["wdir()"] | ||||
opts['allfiles'] = True | opts['all_files'] = True | ||||
getfile = util.lrucachefunc(repo.file) | getfile = util.lrucachefunc(repo.file) | ||||
def matchlines(body): | def matchlines(body): | ||||
begin = 0 | begin = 0 | ||||
linenum = 0 | linenum = 0 | ||||
while begin < len(body): | while begin < len(body): | ||||
match = regexp.search(body, begin) | match = regexp.search(body, begin) |
debugupdatecaches: | debugupdatecaches: | ||||
debugupgraderepo: optimize, run | debugupgraderepo: optimize, run | ||||
debugwalk: include, exclude | debugwalk: include, exclude | ||||
debugwhyunstable: | debugwhyunstable: | ||||
debugwireargs: three, four, five, ssh, remotecmd, insecure | debugwireargs: three, four, five, ssh, remotecmd, insecure | ||||
debugwireproto: localssh, peer, noreadstderr, nologhandshake, ssh, remotecmd, insecure | debugwireproto: localssh, peer, noreadstderr, nologhandshake, ssh, remotecmd, insecure | ||||
files: rev, print0, include, exclude, template, subrepos | files: rev, print0, include, exclude, template, subrepos | ||||
graft: rev, continue, stop, abort, edit, log, no-commit, force, currentdate, currentuser, date, user, tool, dry-run | graft: rev, continue, stop, abort, edit, log, no-commit, force, currentdate, currentuser, date, user, tool, dry-run | ||||
grep: print0, all, diff, text, follow, ignore-case, files-with-matches, line-number, rev, allfiles, user, date, template, include, exclude | grep: print0, all, diff, text, follow, ignore-case, files-with-matches, line-number, rev, all-files, user, date, template, include, exclude | ||||
heads: rev, topo, active, closed, style, template | heads: rev, topo, active, closed, style, template | ||||
help: extension, command, keyword, system | help: extension, command, keyword, system | ||||
identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template | identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template | ||||
import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity | import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity | ||||
incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos | incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos | ||||
locate: rev, print0, fullpath, include, exclude | locate: rev, print0, fullpath, include, exclude | ||||
manifest: rev, all, template | manifest: rev, all, template | ||||
outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos | outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos |
$ echo "unmod" >> um | $ echo "unmod" >> um | ||||
$ hg ci -A -m "adds unmod to um" | $ hg ci -A -m "adds unmod to um" | ||||
adding um | adding um | ||||
$ echo "something else" >> new | $ echo "something else" >> new | ||||
$ hg ci -A -m "second commit" | $ hg ci -A -m "second commit" | ||||
adding new | adding new | ||||
$ hg grep -r "." "unmod" | $ hg grep -r "." "unmod" | ||||
[1] | [1] | ||||
$ hg grep -r "." "unmod" --allfiles | $ hg grep -r "." "unmod" --all-files | ||||
um:1:unmod | um:1:unmod | ||||
$ cd .. | $ cd .. | ||||
Fix_Wdir(): test that passing wdir() t -r flag does greps on the | Fix_Wdir(): test that passing wdir() t -r flag does greps on the | ||||
files modified in the working directory | files modified in the working directory | ||||
$ cd a | $ cd a |