I’m wondering if anyone has worked on a comprehensive .hgignore file for Drupal?

I’m managing Drupal core, modules, and site-specific content with Mercurial (Hg), a distributed version control system (DVCS), using a variant of these instructions for Git, a similar DVCS. It’s made maintaining my sites very easy.

Mercurial has a feature that lets you ignore certain files that otherwise might get checked into your version controlled repositories. You can use both shell-style globbing patterns and regular expression to filter and ignore files, and this is best done before you start checking any into your repository. There are certain files in Drupal that I think are candidates for ignoring — downloads, temporary files, and caches that don’t need to be revision controlled — but I want to sanity check my choices. In particular, I’m not clear on what to do with the files in the Drupal “files” directory. Below is what I have so far, but I’m not sure whether some of these files should be ignored or not, or whether there are others I’ve missed.

.hgignore:

# Glob syntax
syntax: glob
# Tar files downloaded directly into the "modules" directory
sites/all/modules/*.tar.gz
# Zip files downloaded directly into the "modules" directory
sites/all/modules/*.zip
# XML Sitemap module
files/xmlsitemap/sitemap.xml.gz
# Regular expression syntax
syntax: regexp
# CSS files stored in the "files" directory
^files\/css\/[a-z0-9]{32}\.css
# Theme files stored in the "files" directory
^files\/color/*.png

Thanks for any ideas you can share!

Comments

frob’s picture

I always add the settings.php file to the ignore list along with the files directory and the tmp or temp directories used for things like image cache.

Normally it looks something like this.

*/sites/*/settings.php
*/sites/default/files/*.*
*/tmp/*
*/temp/*