如何忽略除.hgignore以外的所有目录? [英] How can I ignore all directories except one using .hgignore?

查看:72
本文介绍了如何忽略除.hgignore以外的所有目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Mercurial管理$ HOME,以保持点文件的良好状态和可跟踪性,或者至少对我来说很重要.

I'm managing $HOME using Mercurial, to keep my dotfiles nice and tracked, or at least the ones that matter to me.

但是,〜中有大量的文件和目录不需要跟踪,并且该目录和目录不断变化和增长.

However, there's a profusion of files and directories in ~ that do not need to be tracked, and that set is ever-changing and ever-growing.

从历史上看,我已经通过使用以下.hgignore来解决了这个问题:

Historically, I've dealt with this by having this .hgignore:

syntax: glob
*

这将使我的状态保持尽可能的整洁,仅使以前跟踪的文件可见.但是,我有一些目录(在我的情况下为scripts.emacs.d),我希望在其中查看未跟踪的文件.我几乎总是要跟踪这些目录中的新内容.

This keeps my status clean, as far as it goes, making only previously tracked files visible. However, I have some directories (in my case, scripts, .emacs.d) that I would like to see untracked files in; I almost always want to track new additions to those directories.

我知道我可以运行hg st -u scripts来识别未跟踪的文件,但是我想要一种可以使用普通ole hg状态实现相同功能的方法.

I know that I can run hg st -u scripts to identify untracked files, but I want a means whereby I can achieve the same function using plain ole hg status.

有没有办法做到这一点?

Is there a way to do this?

推荐答案

请在.hgignore中尝试此操作:

syntax: regexp

^(?!(scripts|foo|bar)/)[^/]+/

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆