Telling You What’s Going On

The hg add example in the preceding section illustrates something else that’s helpful about Mercurial commands. If a command operates on a file that you didn’t name explicitly on the command line, it will usually print the name of the file, so that you will not be surprised what’s going on.

The principle here is of least surprise. If you’ve exactly named a file on the command line, there’s no point in repeating it back to you. If Mercurial is acting on a file implicitly, e.g., because you provided no names, or a directory, or a pattern (see below), it is safest to tell you what files it’s operating on.

For commands that behave this way, you can silence them using the -q option. You can also get them to print the name of every file, even those you’ve named explicitly, using the -v option.

Get Mercurial: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.