.hgignore for CakePHP application?

We are using CakePHP for a new application, and we are using Mercurial as a source control tool. (Mercurial uses a single file .hgignorein the root directory, unlike (for example) CVS, which uses .cvsignorein any directory.)

I would like to exclude the contents of a directory app/tmp/from the source control (as they change all the time and can be restored), but I can not add app/tmp/*to .hgignore, since the standard directories tmp( cache, logs, sessions, testsand cache/models, cache/persistent, ...) will not be absent from new clones made hg clone, which leads to errors.

I currently have in hgignore:

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

It would be nice to have a โ€œstandardโ€ that could be used in all projects. Can anyone suggest a complete solution?

+3
source share
3 answers

You can add

syntax: glob
app/tmp/**

to your file .hgignore, and Mercurial will, from this point on, ignore all files app/tmp/with the exception of files tracked by Mercurial. See file name templates for more information hg help 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 directories will be created app/tmp/cacheand app/tmp/logs, and new files in these directories will be ignored. I think this is what you want?

- $HOME, .

+4

, tmp, tmp. , , , :

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

, tmp, , , , . :

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

hg stat:

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

, , Cake, , , tmp. , -, ? .

0

In my own checks (from SVN), when the site was deployed, the. / Tmp / directory must have certain permissions.

I completely removed it from version control, and my deployment script created directories as needed.

0
source

Source: https://habr.com/ru/post/1706241/


All Articles