CakePHP 应用程序的 .hgignore?

发布于 2024-07-16 07:13:36 字数 664 浏览 7 评论 0原文

我们将 CakePHP 用于新应用程序,并使用 Mercurial 作为源代码控制工具。 (Mercurial 在根目录中使用一个 .hgignore 文件,这与(例如)CVS 在任何目录中使用 .cvsignore 文件不同。)

我想排除来自源代码管理的 app/tmp/ 目录(因为它们一直在变化,并且可以重新生成),但我无法将 app/tmp/* 添加到.hgignore,从那时起 tmp 下的标准目录(cachelogssessions测试以及缓存/模型缓存/持久,...)将在创建的新克隆中丢失hg clone,导致错误。

目前,我的 hgignore 中有一个:

app/tmp/logs/*.log
app/tmp/cache/persistent/cake_*
app/tmp/cache/models/cake_*

如果有一个可以在所有项目中使用的“标准”版本,那就太好了。 有人可以建议一个完整的解决方案吗?

We're using CakePHP for a new application, and we use Mercurial as the source control tool. (Mercurial uses one .hgignore file in the root directory, unlike (for example) CVS that uses .cvsignore in any directory.)

I'd like to exclude the content of the app/tmp/ directory from the source control (since they change all the time, and can be regenerated), but I can't add app/tmp/* to .hgignore, since then the standard directories under tmp (cache, logs, sessions, tests, and also cache/models, cache/persistent, ...) would be missing from new clones made by hg clone, resulting in errors.

Currently I have in my hgignore:

app/tmp/logs/*.log
app/tmp/cache/persistent/cake_*
app/tmp/cache/models/cake_*

It would be good to have a "standard" one that could be used in all projects. Can someone suggest a complete solution?

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

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

发布评论

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

评论(3

谜兔 2024-07-23 07:13:36

您可以添加

syntax: glob
app/tmp/**

到您的 .hgignore 文件,Mercurial 从那时起将忽略 app/tmp/ 下的所有文件,除了跟踪的文件例外由水星。 有关文件名模式的更多信息,请参阅 hg 帮助模式

因此,如果您这样做

% touch app/tmp/cache/.empty
% touch app/tmp/logs/.empty
% hg add app/tmp/cache/.empty
% hg add app/tmp/logs/.empty

并进行克隆,那么将创建 app/tmp/cacheapp/tmp/logs 目录并创建新文件这些目录中的内容将被忽略。 我想这就是你想要的?

这对于跟踪诸如 $HOME 之类的内容也很有用,因为您希望默认情况下忽略大多数文件并且只跟踪显式添加的文件。

You can add

syntax: glob
app/tmp/**

to your .hgignore file and Mercurial will from that point on ignore all files under app/tmp/ with the exception of files tracked by Mercurial. See hg help patterns for more about file name patterns.

So if you do

% touch app/tmp/cache/.empty
% touch app/tmp/logs/.empty
% hg add app/tmp/cache/.empty
% hg add app/tmp/logs/.empty

and make a clone, then the app/tmp/cache and app/tmp/logs directories will be created and new files in those directories will be ignored. I think that is what you want?

This is also useful for tracking something like $HOME since you would want to ignore most files by default and only track explicitly added files.

诗酒趁年少 2024-07-23 07:13:36

如果我正确理解这个问题,您想忽略 tmp 中的文件,但不忽略 tmp 中某些目录中的文件。 如果这是正确的,那么我认为你可以使用以下命令来做到这一点:

syntax: regexp
^tmp/(?!(cache|logs|sessions|test))

这表示忽略以 tmp 开头的任何内容,除非下一部分是缓存、日志、会话、测试。 对于这些文件:

.
`-- tmp
    |-- cache
    |   `-- afile
    `-- tmpfile

这是 hg stat 结果:

$ hg stat
? .hgignore
? tmp/cache/afile

不过,我要注意的是,Cake 可能会告诉您不要基于继承人位于 tmp 目录中而将这些文件放入源代码管理中。 您确定它们不是您的构建系统应该创建的东西吗? 尤其是会议听起来相当短暂。

If I understand the question correctly you want to ignore file in tmp, but not files in certain directories in tmp. If that's right then I think you can do so using this:

syntax: regexp
^tmp/(?!(cache|logs|sessions|test))

That says ignore anything that starts with tmp, unless the next part is cache, log, sessions, test. For these files:

.
`-- tmp
    |-- cache
    |   `-- afile
    `-- tmpfile

here is the hg stat result:

$ hg stat
? .hgignore
? tmp/cache/afile

I will note, though, that Cake is probably telling you not to put those files into source control based ont heir being in a tmp directory. Are you sure they're not something htat your build system is supposed to create? Sessions in particular sound pretty transitory.

一百个冬季 2024-07-23 07:13:36

在我自己的结帐中(来自 SVN),当部署站点时,./tmp/ 目录需要具有一些特定的权限。

我将其从版本控制中完全删除,并且我的部署脚本根据需要创建了目录。

In my own checkouts (from SVN), when the site was deployed, the ./tmp/ directory needed to have some specific permissions.

I removed it from version control entirely, and my deployment script created the directories as required.

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