我的 .hgignore 文件出了什么问题? (没有什么被忽略)

发布于 2024-10-06 04:11:11 字数 183 浏览 1 评论 0原文

我的 .hgignore 文件的内容如下,并且没有任何内容被忽略:

^nbproject$
^.htaccess$
^my.conf$
/media/images/captcha/.*\.jpg$

我尝试将该文件放置在主项目存储库文件夹和工作目录中。

怎么了?请帮忙。

The content of my .hgignore file as follow and NOTHING is being ignored:

^nbproject$
^.htaccess$
^my.conf$
/media/images/captcha/.*\.jpg$

I tried to place the file in the main project repository folder and in the working directory.

What's wrong? Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

习ぎ惯性依靠 2024-10-13 04:11:11

您不需要 syntax:regexp ——这是默认设置。

您确实需要将文件放在 .hg 文件夹上方的目录中,因此布局如下所示:

--yourepo
|
+--- .hgignore
+--- .htaccess
+--- .hg

您还需要转义文件路径中的所有点。试试这个:

^nbproject$
^\.htaccess$
^my.conf$
/media/images/captcha/.*\.jpg$

您确实需要确保尚未添加和/或提交文件。 .hgignore 文件不会覆盖 add,它只会阻止您使用通配符添加内容以及在 .hgstatus 中看到被忽略(未添加)的内容。如果您已经添加了这些文件,则需要hg忘记它们,然后它们才会被忽略。

如果没有任何效果,请尝试以下操作:

hg status --all

并发布输出。

You don't need syntax:regexp -- that's the default.

You do need to put the file in the directory above the .hg folder, so the layout looks like:

--yourepo
|
+--- .hgignore
+--- .htaccess
+--- .hg

You also need to escape all the dots in your file paths. Try this:

^nbproject$
^\.htaccess$
^my.conf$
/media/images/captcha/.*\.jpg$

You do need to make sure you haven't already added and/or committed the files. The .hgignore file does not override add, it only prevents you from adding stuff using wildcards and from seeing ignored (non-added) stuff in .hgstatus. If you've already added these files you need to hg forget them before they'll be ignored.

If nothing's working try this:

hg status --all

and post the output.

妄断弥空 2024-10-13 04:11:11

将此行添加到文件顶部:

syntax: regexp

至于 .hgignore 文件应该放在哪里,按照 https://www.mercurial-scm.org/wiki/.hgignore

.hgignore 文件位于工作中
目录,位于 .hg 文件夹旁边。

Add this line to the top of the file:

syntax: regexp

As for where the .hgignore file should go, per https://www.mercurial-scm.org/wiki/.hgignore

The .hgignore file sits in the working
directory, next to the .hg folder.

淡淡の花香 2024-10-13 04:11:11

对于这种基本的忽略,您可能应该使用更简单的 glob 语法(使用 syntax: glob 指令来明确)。另外,从技术上讲,您应该转义“.”,因为它们是特殊的正则表达式字符,但由于“.”,您很幸运。恰好匹配任何字符,包括文字“.”。然而,像这样的混乱只是强调了我关于使用更简单的 glob 机制的观点。

You should probably use the simpler glob syntax for such basic ignores (with the syntax: glob directive to be explicit). Also, you should technically be escaping the '.'s since they are special regexp characters, but you are lucky since '.' happens to match any character, including the literal '.'. Confusion like this simply underlines my point about using the simpler glob mechanism, however.

还不是爱你 2024-10-13 04:11:11

另请注意,如果 .hgignore 文件以 UTF-8 BOM 开头,则 hg 无法处理该文件。由于这是 Windows 记事本的默认行为,因此您可能需要注意这一点。

Also note that hg can't deal with the .hgignore file if it starts with a UTF-8 BOM. Since this is the default behaviour of Windows Notepad, you might need to watch out for that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文