[PATCH 0 of 4] Add locate command

Soh Tk-r28629 tksoh at freescale.com
Tue Jul 5 19:42:40 CDT 2005


> Other SCM systems have a shorthand way of finding files under SCM
> control using a pattern.  Now Mercurial does, too.
> 
> The locate command lets you search for files under Mercurial control
> based on glob patterns.  It will not print files that aren't in the
> manifest.
> 
> It operates from the current directory.  Here are a few examples:
> 
> $ hg locate '*.c' tags.tmpl
> mercurial/bdiff.c
> mercurial/mpatch.c
> templates/tags.tmpl
> 
> $ hg locate '*git*'
> contrib/git-viz/git-cat-file
> contrib/git-viz/git-diff-tree
> contrib/git-viz/git-rev-list
> contrib/git-viz/git-rev-tree
> contrib/hgit
> 
> $ hg locate --exclude '*/git-viz' '*git*'
> contrib/hgit

Have problem with some patterns:

% ls
CONTRIBUTORS  README          contrib   hgmerge    rewrite-log
COPYING       TODO            doc       hgweb.cgi  setup.py
MANIFEST.in   build           hg        mercurial  templates
PKG-INFO      comparison.txt  hgeditor  notes.txt  tests 

% python hg locate -i 'doc/'
^(?:doc)/
doc/FAQ.txt
doc/Makefile
doc/README
doc/hg.1.txt
doc/hgmerge.1.txt

% python hg locate -i 'doc/*'
^(?:doc\/.*)/

% python hg locate -i 'RE*'
^(?:RE.*)/

%



More information about the Mercurial mailing list