New stuff: hg files

Steve Borho steve at borho.org
Tue Sep 16 05:51:03 CDT 2014


On 09/15, Matt Mackall wrote:
> As discussed at multiple sprints now, it'd be a good idea to unify the
> locate and manifest commands. That command is now 'hg files':
> 
> --
> 
> hg files [OPTION]... [PATTERN]...
> 
> list tracked files
> 
>     Print files under Mercurial control in the working directory or specified
>     revision whose names match the given patterns (excluding removed files).
> 
>     If no patterns are given to match, this command prints the names of all
>     files under Mercurial control in the working copy.
> 
>     Examples:
> 
>     - list all files under the current directory:
> 
>         hg files .
> 
>     - shows sizes and flags for current revision:
> 
>         hg files -vr .
> 
>     - list all files named README:
> 
>         hg files -I "**/README"
> 
>     - list all binary files:
> 
>         hg files "set:binary()"
> 
>     - find files containing a regular expression:
> 
>         hg files "set:grep('bob')"
> 
>     - search tracked file contents with xargs and grep:
> 
>         hg files -0 | xargs -0 grep foo
> 
>     See :hg:'help pattern' and :hg:'help revsets' for more information on
>     specifying file patterns.
> 
>     Returns 0 if a match is found, 1 otherwise.
> 
> --
> 
> A quick example:
> 
> $ hg files -vr . | head
>        798   .hgignore
>      23368   .hgsigs
>       5027   .hgtags
>       1663   CONTRIBUTORS
>      18092   COPYING
>       5480   Makefile
>        547   README
>       3469   contrib/Makefile.python
>      14522   contrib/bash_completion
>       2642 x contrib/buildrpm

/me dons devils advicate hat

is this an opportunity to add an 'hg files --grep' that actually behaves
like grep with the working directory files?

-- 
Steve Borho


More information about the Mercurial-devel mailing list