New stuff: hg files

Matt Mackall mpm at selenic.com
Mon Sep 15 17:28:56 CDT 2014


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

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list