tags:

views:

42

answers:

1

Is there a way to make Mercurial treat a file as if it matches the source control copy even if it has been altered? This was an easy trick to do with Team Foundation Server / Source Safe where just making the file writable through explorer would make those systems ignore that file on check ins.

(Note this is a file that is checked in and has a value but is sometimes different per developer, think connection strings)

+1  A: 

Define aliases in your hgrc for the commit command that excludes the file you don't want to track in the commit.

[alias]
xcommit=commit --exclude path/to/file
xstatus=status --exclude path/to/file

The hgrc reference says that you can define aliases with the same name as existing commands; I found that it worked for hg status but not for hg commit.

I found that .hgignore doesn't obey entries for files that are already in the repository so that's not an option.

Niall C.
Doesn't forget remove the file entirely from version control that on the next push it will be gone from the repo unless you pull a previous change set?
Chris Marisic
@Chris: you're right. I had multiple test repositories and looked in the wrong one to see if my suggestion worked. :( Changed my answer.
Niall C.
Interesting solution, but fairly high on the PITA level to manage.
Chris Marisic