11

5

Possible Duplicate:
Example Visual Studio .hgignore file

In SVN I could add folders and directories to the ingnore list. I would use this feature to ignore all the dll and object file created when building a project.

How do I accomplish the same thing with Kiln/ Tortoisehg

I looked into creating a .hgignore file but Windows 7 would not let me.

I looked into adding entires in the 'Auto Exclude List' in the Commit tab for my repository settings. I tried obj and Web\obj

Any ideas on what I am doing wrong or how to accomplish my goal?

flag

closed as exact duplicate by adambox♦♦ Mar 19 2012 at 20:08

7 Answers

15

Unfortunately, Windows 7's usually helpful file renaming behavior causes problems here. The easiest way to create a .hgignore file in Windows 7:

  1. cd to/my/repo

  2. notepad .hgignore Notepad.exe opens and asks if you want to create the file. Say yes.

  3. Add the following lines to it:

    syntax:glob
    bin/*
    obj/*

  4. Save

link|flag
3 
that was my problem, I was trying to rename a file and win7 would not let me. Thanks for the tip. – Tony Abell Feb 25 2010 at 15:50
When I used "bin/*" in my ignore file, it seemed to still include everything (not sure if it's because it's Windows and got confused by the slash?). I changed it to just "bin" and it worked as expected. Also - you can have a global ignore file by referencing the file in your Mercurial.ini file: [ui] ignore=~/Mercurial.Ignore.ini – Danny Tuppeny Jul 23 2010 at 6:10
2

In the root of your Mercurial repository, make a file called .hgignore with the following:

syntax: glob
bin
obj

or, if the folders are in a folder called Web in the root of the repository, which it looks like they might be, it would be

syntax: glob
Web/obj
Web/bin

Windows 7 should let you create a .hgignore file; I have a pile of them at work. Can you provide more details on what you mean?

link|flag
1

you open a text editor (notepad, notepad2 or notepad++ will do fine), create the ignore list as explained in other answer(s) and save them as ".hgignore". the Windows Explorer doesn't allow you to rename New Text File.txt to .hgignore, but you can do it this way.

link|flag
1

syntax: glob *.dll

That works for all dll's in folder and subfolders.

Question, I want to exclude all my /bin/ folders, but these /bin/ folders exists in a whole heap of directories.. Do I have to include all the paths in my ignore file like this?

syntax: glob

/electronicMod1/bin /electronicMod2/bin /electronicMod3/bin

Or can I do something to say exclude all /bin/ folders in one line...

link|flag
Yes, you can. bin/* - works perfectly. If you add just bin/ - you may also ignore files with name "bin". But mercurial will ignore only folders (and subfolder, and subsubfolders, etc.) if you add an asteric in the end. – Anton Moiseev Mar 26 2010 at 10:46
See also: kiln.stackexchange.com/questions/957/…? – Anton Moiseev Mar 26 2010 at 13:45
5

You can create a global .hgignore file to rule them all by making a .hgignore file and adding a reference to it in the mercurial.ini file. The details are in this StackOverflow answer.

Some useful exclusions for Visual Studio are outlined at http://stackoverflow.com/questions/34784/mercurial-setup-for-visual-studio-2008-projects/2555413#2555413 That answer is more inclusive than the older answers. It will exclude all kinds of stuff you don't want versioned like Resharper folders, builds etc.

link|flag
0

You can use :

\/obj\/
\/bin\/

with regexp syntax

link|flag
0

It's case sensitive, so your Silverlight project's Bin and Obj directories will show up. Add:

Bin
Obj

to your .hgignore file to exclude these too.

link|flag

Not the answer you're looking for? Browse other questions tagged or ask your own question.