ignoring manage.py with Mercurial (hg .hgignore)

888 views Asked by At

i'm using mercurial for my project in Django, and i need to ignore the manage.py. I've my .hgignore like this

syntax: glob
*.pyc
*.html~
*.js~
manage.py
settings_local.py
media/

when i make changes to settings_local.py it working fine, but when i change manage.py the .hgignore does not work

Thanks in advance!!

3

There are 3 answers

3
msarchet On BEST ANSWER

Is the manage.py in the root folder, and if so was it added to the repo before the ignore file was create (thus it is being tracked already). If the second is the case then just tell Hg to forget the file

hg forget manage.py is the syntax I believe.

0
Lasse V. Karlsen On

The .hgignore file only tells relevant commands to avoid picking up new files when you ask them to find files to add to your repository by scanning the directories and finding new and removed files.

The two I can remember, there might be more, are:

hg addremove
hg commit --addremove

That's it. If you either add a file to the repository before you tell Mercurial to ignore it, or specifically add a file to the repository even though it is being ignored, then Mercurial will start tracking the file.

And once it has started tracking it, it will keep on tracking it.

In other words, regardless of whether you have specified the file in .hgignore, the following command will ask Mercurial to start tracking the file:

hg add manage.py

Whether you did this before or after you edited the .hgignore file is irrelevant.

Your question sounds like Mercurial is already tracking this file. To get Mercurial to stop tracking the file, issue a forget command:

hg forget manage.py

and then do a commit. After that, changes to that file will not be picked up by Mercurial.

1
Maik On

just make sure you've not added your .hgignore file.

If you did just forget .hgignore and then commit again.

This should ignore your manage.py with the next commit !