Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is .hgignore being ignored?

I am very new to Hg so please excuse my ignorance here...

I am using Mercurial and TortoiseHg in Windows 7. I have a repository created that has the following folder structure:

-- My repo dir
|
|--- .hg
|--- .hgignore
|--- File 1
|--- File 2
|--- ...

My database data files live in the repo directory but I do not want them to be included as part of the repository. I've tried all kinds of things in the .hgignore file, but regardless when I right-click on the repo folder in the Windows Shell and go to Hg Commit..., it includes the two database data files in the list of files to be committed. Yes, I can uncheck them manually, but my thought was that by being in .hgignore they wouldn't be included in the list of files to commit.

Here's my current incarnation of .hgignore, although I've tried a handful of others with no luck:

MyDatabase\.mdf
MyDatabase\_log\.ldf

Am I being daft here, or is it that TortoiseHg does not respect/inspect the .hgignore file when committing?

UPDATE:

Finally got this to work. I had to instruct Mercurial to forget the files, as @Diego suggested. Interestingly, though, when I followed @Diego's suggestions and tried to forget them via the command-line it did not work. I had to go to Windows Explorer, right-click on the files, and from the context menu I chose TortoiseHg --> Forget Files...

Thanks for the suggestions, everyone.

like image 727
Scott Mitchell Avatar asked Nov 05 '11 00:11

Scott Mitchell


1 Answers

Maybe mercurial is already tracking those files. If files are already tracked then .hgignore does not have any effect. Try:

hg forget MyDatabase\.mdf MyDatabase\_log\.ldf

Then edit .hgignore to exclude those files and commit.

That should solve it.

like image 177
Diego Avatar answered Oct 05 '22 07:10

Diego