Ignoring changed files

Thomas Arendsen Hein thomas at intevation.de
Sat Dec 2 03:22:49 CST 2006


* Chui Tey <teyc at cognoware.com> [20061201 13:42]:
> Sometimes changesets get in the way when local configuration files have to
> be tweaked. 
> For example, the repository has a file
> 
> config.php
> 
> After cloning the repository locally, I had to adjust the config.php. Now I
> don't want to commit the changes in this file. 
> 
> Unfortunately, adding it to .hgignore doesn't seem to help.

.hgignore only ignores files that are not yet tracked by Mercurial.

You have some options:

- Commit your changes to config.php and regularly merge when pulling
  in new things from the original repository.

- hg rename config.php example-config.php, and commit. Then copy
  example-config.php to config.php and edit as you like. You need to
  do the rename in the original repository, otherwise you still have
  to regularly merge as noted above.

- Use the mq extension to track changes to config.php:
  $ hg qnew mylocalconfig
  $ $EDITOR config.php
  $ hg qrefresh
  Whenever you want to pull in new changes from the original
  repository, you need some extra steps:
  $ hg qpop -a  # removes your local config.php changes
  $ hg pull
  $ hg update
  $ hg qpush -a # adds your local config.php changes again

Today I'm mostly using the mq solution.

Thomas

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/


More information about the Mercurial mailing list