How to ignore the .classpath for Eclipse projects using Mercurial? - mercurial

I'm trying to share a repository between my Mac (laptop) and PC (desktop). There are some external dependencies for the project that are stored on different places on each machine, and noted in the .classpath file in the Eclipse project. When the project changes are shared, the dependencies break. I'm trying to figure out how to keep this from happening.
I've tried using .hgignore with the following settings, among others, without success:
syntax: glob
*.classpath
Based on this question, it appears that the .hgignore file will not allow Mercurial to ignore files that are also committed to the repository. Is there another way around this? Other ways to configure the project to make it work?

The file must not be already commited to be ignored (as you noted in your question), other wise a 'hg remove -Af .classpath' is required to remove it from the repo without removing it from your local working tree.
And:
syntax: glob
.classpath
should be enough (no '*' needed)

Related

Can I use opam to make a package out of a local file and install it?

I'm new to opam and trying to figure out how to use it properly. For a class, I want to set up students with an environment that has some custom packages installed. (The package will consist of some raw .ml files that I got from a colleague at another school; the files are on their github but there's no .opam file that I can see, and as far as I know they're not in any official package release.)
Can I somehow call these local .ml files a package and ask opam to install it? Do the files have to be on github first, and if so can I use my colleague's existing repository as the source? I don't want to make any of this public, since it is not my own work; I just want to configure my local environment so that the code in the files can be included easily as a package. Basically I don't know the best way to proceed so I'm happy for any advice.
You can add a custom opam file in the base directory of the project. See the documentation for how to create that file.
Then you can enter opam pin add . in the base directory and your project will be installed as if it was an opam package. Check opam pin --help for more info (you can also pin to a remote git project for instance).
Note that though the default repository is hosted on github, this is in no way a requirement for opam. Opam is dependent on git but you can absolutely use it with a private git repository. If you want to use your colleague's repository as the source, that is totally doable though it is often preferable to have the opam file at the root of the directory (you can do a PR on their repository or make your own fork of it on github, the site makes it clear you copied the code).
If pinning is not to your taste, you can also create your own repository though this is probably a bit too heavyweight for your needs.
Good luck!

Why do some Rails projects use multiple database.yml files with different extensions (mysql, postgresql etc)?

I've seen this in the source code of Gitlab
Managed to run bundle install successfully. But while running the server with rails s command an error is shown saying database.yml is missing. My first thought was to rename database.yml.mysql to database.yml but resisted the temptation for monkey patches. I would like to know why this was done and what's the underlying standard behind this convention.
Since database.yml should not be committed to the source code for various reasons (their .gitignore explicitly removes database.yml from the repo), maintainers tend to put .yml.template as a guide for those would fork the repo. It's not meant to be renamed but rather copied as renaming it would be removing the template.
The multiple extensions (i.e .mysql, .postgres) are just there for you to know what to copy when you use different databases.

Mercurial (TortoiseHG) won't commit after manually deleting some files

I removed some database files from my project using the search function in Explorer. After that Mercurial complains that it cannot find the files an refuses to commit. I tried using the shelve tool, but I run then in a bugreport for version 2.5 of TortoiseHG stating that the node holding the database file could not be found.
'
How do I solve this?
It it possible you deleted not only the files in your working directory but also down in the data store itself (.hg/....)? It's possible to do that if you search indelicately in explorer. Here's the command line equivalent:
ry4an#four:~/projects/unblog$ find . -name '*.xml*'
./static/attachments/2005-09-22-isle-royale.gpx.xml
./.hg/store/data/static/attachments/2005-09-22-isle-royale.gpx.xml.i
It is entirely safe and okay for me to delete that .gpx.xml file, but if I deleted every file with .gpx.xml in the name then I'd be deleting the file from the store and corrupting my repository.
Try running hg verify in the repository and see what output you get.

Intellij 11.0.1 seems to be ignoring my .hgignore file

I have the following .hgignore file that should keep Intellij's constantly changing internal config files from polluting our source control.
syntax: glob
.idea/*
target/*
logs/*
out/*
myapp.iml
myapp-web.iml
Tortoise and the command line seem to respect the fact that files like ".idea/dataSources.xml" are not meant to be added to source control but intellij's hg4idea are constantly asking if I would like to add files like ".idea/dataSources.xml" to source control.
Is my .hgignore file just wrong or is there a bug in Intellij?
It's a known bug, please vote. As a workaround you can ignore files in Settings | Version Control | Ignored Files.
To add files to the IntelliJ ignore list go to:
Settings
Version Control
Ignored Files

How can I share a commit-hook in mercurial with all fellow developers?

we are working with mercurial and now we would like to introduce precommit hooks to keep the code clean. We would like everyone to somehow get the hooks, but we would also like to be able to update this in some centralized way. Mercurial does not version control hooks, so what would be our alternative option?
Do any of you have found a solution for this?
Thanks in advance!
Nemmi
Hooks are not cloned (as detailed in "Version-controlled extension configuration in Mercurial"), but you can have a common hgrc file (see hgrc Syntax):
A line of the form %include file will include file into the current configuration file
In that central configuration file, you can then modify the [hooks] section.
If you have control over their desktops (it's a standard corporate install) you can put the hook in the system-wide entries /etc/mercurial/hgrc or /etc/mercurial/hgrc.d/ourcommithook
If you're remotely administering the machines you could automate this using something like the very excellent puppet or by building your own .rpm, .deb, or .msi installer which both installed Mercurial and places the everyone hooks in the machine-global config.
Have a look at the projrc extension. You then simply need to have designers put a small number of common lines in their ~/.hgrc files and they will automatically get pushed whatever you put in your centralized repo's repo/.hg/projrc file.
You will still need a common place to put these hooks but you probably already have some sort of shared mounted drive that users all mount, right? Or you could have a "tools" repository that everybody has to have checked out in a standard location.
Steve