tags:

views:

183

answers:

1

I find the output of hg status too verbose for untracked directories. Suppose I have an empty repository that's managed by both git and hg. So there would be two directories, .git and .hg.

The output of git status is:

# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .hg/

The output of hg status is:

? .git/HEAD
? .git/config
? .git/description
? .git/hooks/applypatch-msg.sample
? .git/hooks/commit-msg.sample
? .git/hooks/post-commit.sample
? .git/hooks/post-receive.sample
? .git/hooks/post-update.sample
? .git/hooks/pre-applypatch.sample
? .git/hooks/pre-commit.sample
? .git/hooks/pre-rebase.sample
? .git/hooks/prepare-commit-msg.sample
? .git/hooks/update.sample
? .git/info/exclude

Is there a way to reduce its output to something like the following line?

? .git/
+6  A: 

You can just add in your .hgignore file

 syntax:glob
.git
.gitattributes
.gitignore

To ignore .git entirely, and other git-related files.

If the goal is to only limit to a directory, you can still use .hgignore if you add an hidden file in that directory (after this answer):

 syntax:regex
 ^.git/(?!\.hidden).+$

Since Mercurial do not track directories at all, that will ignore all files within .git except the hidden one, effectively displaying only one line in the status.

You would also have the option -q/--quiet (to hg status), which hides untracked (unknown and ignored) files unless explicitly requested with -u/--unknown or -i/--ignored.
But that means .git would not even show up in that case.


But if the goal is to limit in general the output of hg status to only the directories and not their content for untracked files, then I believe this is not possible:

  • git track content of files and since no content is added, it only mentions the top directory has "having no content added"
  • mercurial tracks files (not directories), hence the comprehensive list (of files).
VonC
That's not my point. I used the `.git` directory just as an example.
Wei Hu
@Wei: right, I have completed my answer to reflect your actual question
VonC
Thanks. Upvoted.
Wei Hu