Mercurial 忽略目录的一部分
在 Windows 下与 Mercurial 的 .hgignore 斗争了一段时间。
我有一个名为 Upload 的文件夹,目前为空。我确实希望跟踪它,所以我在其中添加了一个工作正常的 .empty 文件。我希望这样,以便进行 hg 克隆的新开发人员能够获得应用程序所需的上传文档。
问题是我从来不希望文件夹中填充源代码控制本身的任何内容(从开发机器测试上传)。
例子: 如果我添加 Public/image.jpg 它将不会被跟踪。
另外我希望它能够跟踪子目录。因此,如果开发人员添加
Upload/users/.empty 我希望对其进行跟踪。
这可以用正则表达式巫毒吗?
Been fighting with Mercurial's .hgignore for a while under Windows.
I have a folder named Upload which is currently empty. I do want it tracked so I added a .empty file in it which work fine. I want this so that new developers doing an hg clone get the Upload document required for the application.
Thing is I never want the folder to be populated with anything on the source control itself (test uploads from a development machine).
Example:
If I add Public/image.jpg it wouldn't be tracked.
Additionally I would like it for sub directory to be tracked. So if developer adds
Upload/users/.empty I would like this to be tracked.
Is this possible with regex voodoo?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 Mercurial 中(与 svn 和 cvs 不同)添加文件会覆盖
.hgignore
文件,因此您可以将其放入.hgignore
中:以及您的
Upload/您添加的 .empty
仍将在更新时创建,因此他们将获得该目录。要使其忽略上传中的文件,但不忽略上传中子目录中的文件,可以使用以下命令来完成:
其表示:忽略以上传开头并且其中没有进一步斜杠的任何内容。
实际上,您应该尽可能使用构建/安装/配置脚本创建上传,而不是使用克隆/更新。
In mercurial (and unlike in svn and cvs) adding a file overrides the
.hgignore
file, so you can put this in your.hgignore
:and your
Upload/.empty
that you added will still be created on update and thus they'll get the directory.Getting it to ignore files in upload but not not ignore files in subdirectories in Upload could be done with:
which says: ignore anything that Starts with Uploads and has no further slashes in it.
Really though, you should be creating Uploads with your build/install/configure script when possible, not with the clone/update.
尝试将
.hgignore
放入存储库的 root 中Try putting
in
.hgignore
in the root of the repository尝试
此操作应匹配以
Uploads
开头的任何路径,其中最后一个斜杠 (=filename) 后面的文本不是.empty
。Try
This should match any path starting with
Uploads
where the text after the last slash (=filename) is anything but.empty
.