CakePHP 应用程序的 .hgignore?
我们将 CakePHP 用于新应用程序,并使用 Mercurial 作为源代码控制工具。 (Mercurial 在根目录中使用一个 .hgignore
文件,这与(例如)CVS 在任何目录中使用 .cvsignore
文件不同。)
我想排除来自源代码管理的 app/tmp/
目录(因为它们一直在变化,并且可以重新生成),但我无法将 app/tmp/*
添加到.hgignore
,从那时起 tmp
下的标准目录(cache
、logs
、sessions
、测试
以及缓存/模型
、缓存/持久
,...)将在创建的新克隆中丢失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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以添加
到您的
.hgignore
文件,Mercurial 从那时起将忽略app/tmp/
下的所有文件,除了跟踪的文件例外由水星。 有关文件名模式的更多信息,请参阅hg 帮助模式
。因此,如果您这样做
并进行克隆,那么将创建
app/tmp/cache
和app/tmp/logs
目录并创建新文件这些目录中的内容将被忽略。 我想这就是你想要的?这对于跟踪诸如
$HOME
之类的内容也很有用,因为您希望默认情况下忽略大多数文件并且只跟踪显式添加的文件。You can add
to your
.hgignore
file and Mercurial will from that point on ignore all files underapp/tmp/
with the exception of files tracked by Mercurial. Seehg help patterns
for more about file name patterns.So if you do
and make a clone, then the
app/tmp/cache
andapp/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.如果我正确理解这个问题,您想忽略 tmp 中的文件,但不忽略 tmp 中某些目录中的文件。 如果这是正确的,那么我认为你可以使用以下命令来做到这一点:
这表示忽略以 tmp 开头的任何内容,除非下一部分是缓存、日志、会话、测试。 对于这些文件:
这是
hg stat
结果:不过,我要注意的是,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:
That says ignore anything that starts with tmp, unless the next part is cache, log, sessions, test. For these files:
here is the
hg stat
result: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.
在我自己的结帐中(来自 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.