Mercurial 不会忽略我指定的目录中的文件

发布于 2024-12-26 06:37:28 字数 2405 浏览 4 评论 0原文

我有水银存储库。有 .hgignore 文件:

λ ~/workspace/kompgrafika/nurbs/ cat .hgignore 
syntax: regexp
^Makefile
^bin/.*$
CMakeFiles/.*$
^CMakeCache\.txt
^cmake_install\.cmake

有一个名为 CMakeFiles 的目录,我想忽略:

λ ~/workspace/kompgrafika/nurbs/ tree CMakeFiles 
CMakeFiles
├── 3dfractals.dir
│   ├── build.make
│   ├── cmake_clean.cmake
│   ├── CXX.includecache
│   ├── DependInfo.cmake
│   ├── depend.internal
│   ├── depend.make
│   ├── flags.make
│   ├── link.txt
│       ├── progress.make
│   └── src
│       ├── DisplayControl.cpp.o
│       ├── Drawer.cpp.o
│       ├── main.cpp.o
│       ├── PointFileReader.cpp.o
│       ├── PointGenerator.cpp.o
│       └── Program.cpp.o
├── CMakeCCompiler.cmake
├── cmake.check_cache
├── CMakeCXXCompiler.cmake
├── CMakeDetermineCompilerABI_C.bin
├── CMakeDetermineCompilerABI_CXX.bin
├── CMakeDirectoryInformation.cmake
├── CMakeOutput.log
├── CMakeSystem.cmake
├── CMakeTmp
│   └── CMakeFiles
│       └── cmTryCompileExec.dir
├── CompilerIdC
│   ├── a.out
│   └── CMakeCCompilerId.c
├── CompilerIdCXX
│   ├── a.out
│   └── CMakeCXXCompilerId.cpp
├── Makefile2
├── Makefile.cmake
├── progress.marks
└── TargetDirectories.txt

7 个目录,31 个文件,

但运行 hg status 由于某种原因,它不会忽略 3dfractals.dir 。

λ ~/workspace/kompgrafika/nurbs/ hg st
A .hgignore
A docs/pol_10.wings
? CMakeFiles/3dfractals.dir/src/DisplayControl.cpp.o
? CMakeFiles/3dfractals.dir/src/Drawer.cpp.o
? CMakeFiles/3dfractals.dir/src/PointFileReader.cpp.o
? CMakeFiles/3dfractals.dir/src/PointGenerator.cpp.o
? CMakeFiles/3dfractals.dir/src/Program.cpp.o
? CMakeFiles/3dfractals.dir/src/main.cpp.o

我正在使用:

λ ~/workspace/kompgrafika/nurbs/ hg --version
Mercurial Distributed SCM (version 2.0.2+5-1f9f9b4c2923)
(see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2011 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

我还尝试将 CMakeFiles/.*$ 更改为 ^CMakeFiles$。没有结果。

任何想法有什么问题吗?

I have mercurial repository. There is .hgignore file:

λ ~/workspace/kompgrafika/nurbs/ cat .hgignore 
syntax: regexp
^Makefile
^bin/.*$
CMakeFiles/.*$
^CMakeCache\.txt
^cmake_install\.cmake

There is directory named CMakeFiles that I want to ignore:

λ ~/workspace/kompgrafika/nurbs/ tree CMakeFiles 
CMakeFiles
├── 3dfractals.dir
│   ├── build.make
│   ├── cmake_clean.cmake
│   ├── CXX.includecache
│   ├── DependInfo.cmake
│   ├── depend.internal
│   ├── depend.make
│   ├── flags.make
│   ├── link.txt
│       ├── progress.make
│   └── src
│       ├── DisplayControl.cpp.o
│       ├── Drawer.cpp.o
│       ├── main.cpp.o
│       ├── PointFileReader.cpp.o
│       ├── PointGenerator.cpp.o
│       └── Program.cpp.o
├── CMakeCCompiler.cmake
├── cmake.check_cache
├── CMakeCXXCompiler.cmake
├── CMakeDetermineCompilerABI_C.bin
├── CMakeDetermineCompilerABI_CXX.bin
├── CMakeDirectoryInformation.cmake
├── CMakeOutput.log
├── CMakeSystem.cmake
├── CMakeTmp
│   └── CMakeFiles
│       └── cmTryCompileExec.dir
├── CompilerIdC
│   ├── a.out
│   └── CMakeCCompilerId.c
├── CompilerIdCXX
│   ├── a.out
│   └── CMakeCXXCompilerId.cpp
├── Makefile2
├── Makefile.cmake
├── progress.marks
└── TargetDirectories.txt

7 directories, 31 files

But running hg status it does not ignore 3dfractals.dir for some reason.

λ ~/workspace/kompgrafika/nurbs/ hg st
A .hgignore
A docs/pol_10.wings
? CMakeFiles/3dfractals.dir/src/DisplayControl.cpp.o
? CMakeFiles/3dfractals.dir/src/Drawer.cpp.o
? CMakeFiles/3dfractals.dir/src/PointFileReader.cpp.o
? CMakeFiles/3dfractals.dir/src/PointGenerator.cpp.o
? CMakeFiles/3dfractals.dir/src/Program.cpp.o
? CMakeFiles/3dfractals.dir/src/main.cpp.o

I am using:

λ ~/workspace/kompgrafika/nurbs/ hg --version
Mercurial Distributed SCM (version 2.0.2+5-1f9f9b4c2923)
(see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2011 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I also tried changing CMakeFiles/.*$ to ^CMakeFiles$. No results.

Any ideas what's wrong?

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

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

发布评论

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

评论(2

岁月流歌 2025-01-02 06:37:28

嗯,它在这里工作:

$ cat .hgignore
syntax:regexp
^Makefile
^bin/.*$
CMakeFiles/.*$
^CMakeCache\.txt
^cmake_install\.cmake
$ hg init
$ mkdir -p $(dirname CMakeFiles/3dfractals.dir/src/DisplayControl.cpp.o)
$ touch CMakeFiles/3dfractals.dir/src/DisplayControl.cpp.o
$ touch CMakeFiles/cmake.check_cache
$ hg status
? .hgignore
$ hg status -A
? .hgignore
I CMakeFiles/3dfractals.dir/src/DisplayControl.cpp.o
I CMakeFiles/cmake.check_cache

这是 Mercurial 2.0.2+59,所以它应该与您的版本工作相同。

如您所见,可能会导致 hg status 的一件事是 inotify扩展。正如其 wiki 页面上所提到的,它仍然被视为实验性的,因为它仍然有错误。检查 inotify

$ hg showconfig extensions.inotify

并在必要时禁用它。如果扩展是从您自己的配置文件加载的(使用 hg showconfig --debug 检查),那么您只需删除加载它的行即可。如果它加载到您无法更改的系统范围配置文件中,则添加

[extensions]
inotify = !

到您自己的配置文件中以禁用它。

Hmm, it works here:

$ cat .hgignore
syntax:regexp
^Makefile
^bin/.*$
CMakeFiles/.*$
^CMakeCache\.txt
^cmake_install\.cmake
$ hg init
$ mkdir -p $(dirname CMakeFiles/3dfractals.dir/src/DisplayControl.cpp.o)
$ touch CMakeFiles/3dfractals.dir/src/DisplayControl.cpp.o
$ touch CMakeFiles/cmake.check_cache
$ hg status
? .hgignore
$ hg status -A
? .hgignore
I CMakeFiles/3dfractals.dir/src/DisplayControl.cpp.o
I CMakeFiles/cmake.check_cache

This is with Mercurial 2.0.2+59, so it should work the same as your version.

One thing that can trip up hg status in the way you see is the inotify extension. As mentioned on its wiki page, it's still to be considered experimental because it's still buggy. Check for inotify with

$ hg showconfig extensions.inotify

and disable it if necessary. If the extension is loaded from your own configuration file (check with hg showconfig --debug) then you can just remove the line that loads it. If it's loaded in a system-wide config file that you cannot change, then add

[extensions]
inotify = !

to your own config file to disable it.

愿得七秒忆 2025-01-02 06:37:28

我使用的是 Windows,但通常

CMakeFiles/*

会对我有用......

I'm on Windows, but usually

CMakeFiles/*

would do the trick for me...

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