Imagine a directory structure like this...
project
|-- development.ini
|-- run.py
`-- data
Data is a directory that stores the data for your project while running, so you want to ignore it. Opening up your .hgignore file you've had for awhile, you see something like this...
syntax:glob
*.pyc
*.log
...and you decide to do this...
syntax:glob
*.pyc
*.log
data
This is a bad move. Sooner or later, your project is going to look like this...
project
|-- development.ini
|-- run.py
|-- data
`-- src
|-- main.py
`-- parts
|-- graphics
| |-- stuff.py
| `-- stuff2.py
`-- data <-- !!!
|-- loader.py
`-- retrieval.py
And suddenly, when you make that src/parts/data directory, it's going to be ignored by Mercurial. If you want to ignore a specific directory, such as one that is used for data (common when using pylons), it's better to use:
syntax:regexp
^data$
This will ignore any file or directory in your entire repository that goes by the name "data". Note that this is the name relative to the project's root, so our data file in the src directory would not be matched since it's name is 'src/parts/data'. The ^ and $ are used in regular expressions to signify the start and end of the string.
No comments:
Post a Comment