Refactor ignore files (gitignore and hgignore)
Refactored the ignore files, changes include:
- Both files are now the same.
- Grouped the rules so it's more clear why they exist
- Added exceptions for files that were on in the ignore files, but are tracked in the repository and should not be ignored. For example some Makefiles that don't have a Makefile.am
- Rewrote some rules to make them shorter.