##// END OF EJS Templates
change locate to use relglobs by default...
Alexis S. L. Carvalho -
r4195:e8ee8fde default
parent child Browse files
Show More
@@ -127,15 +127,16 b' def make_file(repo, pat, node=None,'
127 127 pathname),
128 128 mode)
129 129
130 def matchpats(repo, pats=[], opts={}, head='', globbed=False):
130 def matchpats(repo, pats=[], opts={}, head='', globbed=False, default=None):
131 131 cwd = repo.getcwd()
132 132 return util.cmdmatcher(repo.root, cwd, pats or [], opts.get('include'),
133 opts.get('exclude'), head, globbed=globbed)
133 opts.get('exclude'), head, globbed=globbed,
134 default=default)
134 135
135 136 def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None,
136 globbed=False):
137 globbed=False, default=None):
137 138 files, matchfn, anypats = matchpats(repo, pats, opts, head,
138 globbed=globbed)
139 globbed=globbed, default=default)
139 140 exact = dict.fromkeys(files)
140 141 for src, fn in repo.walk(node=node, files=files, match=matchfn,
141 142 badmatch=badmatch):
@@ -1602,9 +1602,8 b' def locate(ui, repo, *pats, **opts):'
1602 1602 Print all files under Mercurial control whose names match the
1603 1603 given patterns.
1604 1604
1605 This command searches the current directory and its
1606 subdirectories. To search an entire repository, move to the root
1607 of the repository.
1605 This command searches the entire repository by default. To search
1606 just the current directory and its subdirectories, use "--include .".
1608 1607
1609 1608 If no patterns are given to match, this command prints all file
1610 1609 names.
@@ -1622,7 +1621,7 b' def locate(ui, repo, *pats, **opts):'
1622 1621 node = None
1623 1622
1624 1623 for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=node,
1625 head='(?:.*/|)'):
1624 default='relglob'):
1626 1625 if not node and repo.dirstate.state(abs) == '?':
1627 1626 continue
1628 1627 if opts['fullpath']:
@@ -832,6 +832,9 b' class localrepository(repo.repository):'
832 832
833 833 if node:
834 834 fdict = dict.fromkeys(files)
835 # for dirstate.walk, files=['.'] means "walk the whole tree".
836 # follow that here, too
837 fdict.pop('.', None)
835 838 mdict = self.manifest.read(self.changelog.read(node)[0])
836 839 mfiles = mdict.keys()
837 840 mfiles.sort()
@@ -382,10 +382,11 b" def matcher(canonroot, cwd='', names=[],"
382 382 return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src)
383 383
384 384 def cmdmatcher(canonroot, cwd='', names=[], inc=[], exc=[], head='',
385 src=None, globbed=False):
386 if not globbed:
385 src=None, globbed=False, default=None):
386 default = default or 'relpath'
387 if default == 'relpath' and not globbed:
387 388 names = expand_glob(names)
388 return _matcher(canonroot, cwd, names, inc, exc, head, 'relpath', src)
389 return _matcher(canonroot, cwd, names, inc, exc, head, default, src)
389 390
390 391 def _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src):
391 392 """build a function to match a set of file patterns
@@ -28,7 +28,6 b' reverting a'
28 28 changeset 3:4cbb1e70196a backs out changeset 1:22bca4c721e5
29 29 the backout changeset is a new head - do not forget to merge
30 30 (use "backout --merge" if you want to auto-merge)
31 b: No such file or directory
32 31 adding a
33 32 adding b
34 33 adding c
@@ -31,7 +31,6 b' a'
31 31 a
32 32 % rename and modify
33 33 applying patch from stdin
34 copy2: No such file or directory
35 34 a
36 35 a
37 36 b
@@ -40,7 +39,6 b' a'
40 39 % one file renamed multiple times
41 40 applying patch from stdin
42 41 9 rename2 rename3 rename3-2 / rename3 (rename2)rename3-2 (rename2)
43 rename2: No such file or directory
44 42 rename3
45 43 rename3-2
46 44 a
@@ -3,18 +3,14 b' adding b'
3 3 adding t.h
4 4 adding t/x
5 5 a
6 NONEXISTENT: No such file or directory
7 6 a
8 7 b
9 8 t.h
10 9 t/x
11 a: No such file or directory
12 NONEXISTENT: No such file or directory
13 10 b
14 11 t.h
15 12 t/x
16 13 a
17 NONEXISTENT: No such file in rev ce18e5bc5cd3
18 14 a
19 15 b
20 16 t.h
General Comments 0
You need to be logged in to leave comments. Login now