how to add a dot-directory to mercurials hgignore - eclipse

I have used mercurial for some time now and never had any problems using hgignore.
Now I have created a new project using eclipse, which added a .metadata directory.
I seem to be unable to ignore the .metadata.
nils#yavin $ hg status
? .metadata/.mylyn/repositories.xml.zip
? .metadata/.plugins/org.eclipse.core.resources/.history/37/509db4063df7001f14dbbfe704ff2c4e
...
My .hgignore looks like this:
syntax: regexp
/\.metadata/.*
\.metadata/.*
glob:.metadata/*
glob:.metadata/.mylyn/repositories.xml.zip
As you can see, I tried some things... I even tried adding one file directly, but it did not work.
Is there any magic involved when dealing with dot-directories? Or am I simply stupid today?

Just remove everything and leave:
glob:.metadata/*
The first line syntax:regexp in your .hgignore is making hg treat all subsequent lines as regex, including the one with glob:.metadata/*

Related

.gitignore - Ignore everything in a directory except one file

I know there is a lot of questions like this, but no one solved my problem. I want something very simple - ignore all files and folders under specific folder except one file. This is what I try:
#Ignore
public/typings/*
#Allow
!public/typings/browser/ambient/jquery/jquery.d.ts
...but the file is still ignored.
Any suggestions?
It seems ! only works if the file is in the same folder. A possible workaround would be to nest the same statement till you get to your final file. A bit messy, but it works.
public/typings/*
!public/typings/browser
public/typings/browser/*
!public/typings/browser/ambient
public/typings/browser/ambient/*
!public/typings/browser/ambient/jquery
public/typings/browser/ambient/jquery/*
!public/typings/browser/ambient/jquery/jquery.d.ts
If the file was added in a previous commit before you put it in git ignore, it's possible your .gitignore is not working. I had the same problem few days ago. I solved the problem thanks to this post:
Post int randallkent
I hope this helps you
EDIT:
solution was found here: gitignore directory exception not working
I've been struggling a lot with this subject, let me share a procedure that worked for me:
1) Add the top level folder "abc/" to your .gitignore
2) Let's say that in "abc/" you have also "def/" and "jkl/" folders. If you want to keep the contents of "jkl/" you can just do:
git add -f jkl/*.php
Ok! Now everything inside "jkl/" with .php extension will be tracked by git, even in the next commits, without any headaches!
I've found this to be the right solution for my case, because I was really going insane trying to understand how gitignore does scan files and directories.

How to override a negation pattern in the root .gitignore file?

I want Git to ignore a file named .wh..wh.aufs in the repo's root directory, because it was generated by my local file system (AUFS). But it doesn't help to place the pattern *.aufs in my ~/.config/git/ignore file, because the repo's root directory also has a .gitignore file with the negation pattern !.*.
Apparently the developers I cloned from want to force-track all files beginning with a dot. I still hope to share changes with them, and don't want to disrupt their arrangements. Without modifying their negation pattern, what's the best way to tell git to ignore my .wh..wh.aufs file?
I read the man page. The precedence policy seems to be working against me, unless there's something reliable I could do on the command line.
Check out the third technique here, maybe?
https://help.github.com/articles/ignoring-files
Adding the rule to .git/info/exclude might work for you.

CVS keeps adding code at the end of the file I want to commit

I have trouble with 4 files in my CVS project. Each time I commit one of those files, CVS keeps adding the same line of code at the end of it. This line of code is a repeated line of the current file (but not the last line of it).
I've try several things : update, delete lines and commit, delete all lines and commit, adding lines and commit, adding header and commit. But I always get the same line of code added to the end of my file. I could delete all files and recreate those, but I would lost all my history data.
I find it awkward that CVS is modifying my file when I commit. Is it not counter productive as it may add errors in a compliant code?
I could add that my file is a .strings (text file, unicode). I'm working on a branch, but recently merge it in the trunk.
More Details:
I'm using TortoiseSVN on a virtual Windows machine, which has access to my Documents folder of Mac OS X via a Network Drive between those two.
It turns out that my colleague, which has the same project but on a real Windows folder, could commit without any problem.
And now that he done that, the problem is solve for me too.
But I have no idea what happen. My only clue would be a hidden character in Mac OS X that would breaks TortoiseSVN. Is it possible?
I haven't experienced this issue with CVS, but note that you mention that the file you are editing is Unicode text (you don't mention if this means UTF8 or UTF16, but either can cause issues).
Depending on how your CVS server was built, and how (and on what platform) it is being run, it is highly possible that the server is not Unicode-aware. This can cause a whole range of possible issues, including expanding RCS-style $ tags in places where the second (or later) byte of a Unicode character is equal to ASCII '$'.
The workaround for this is to mark Unicode source files as binary objects. From the command line, this can be done using
cvs add -kb file-name
when adding a new file, or
cvs admin -kb file-name
for an existing file (replace file-name with the name of your file).
In the latter case, I'd recommend removing the (local copy of the) file and running 'cvs update' to get it back after changing the type.
Note that doing this is unlikely to help with changes you're already seeing in the file, so make sure to check the file, and fix any existing problem after making this change.

Mercurial [HG] - Get the list of .hgignore excluded files

I use this .hgignore file liberally in my projects, it has proven worthy so far.
However, every once in a while I'd like to do a reality check, to make sure it didn't eat up something valuable.
My question is: how can I find out the exact list of excluded files? (The files that actually match the .hgignore patterns)
Answers using TortoiseHg or command-line are welcome.
The command hg status --ignored (or hg status -i) lists the files that have been ignored.
The answer hit me while I was finishing the question (yet again).
It's trivial, actually:
Start by making sure there are no pending commits.
(Re)move/rename the .hgignore file
Hit 'Refresh' in TortoiseHg's commit window.
You'll now get the exact list of ignored files (+ the change to the .hgignore file itself).
Rubber ducking at its best. (Hmm, SO should add a badge for this :)

How to get the cvs change list for a new file

As part of my work I've been asked to log the cvs commands for creating the changelists for files I've updated as follows:
cvs diff -r 1.172 -r 1.173 ./somefile.php
But if the file is newly created for that job, no previous version number exists so I can't compare it to anything. Ideally I'd like to compare it with an empty file so it shows all lines were added. Can this be done?
Initially the best way I found to do this was to use:
cvs annotate -r1.1 ./somefile.php
Assuming the 1.1 is the version number of the new file. It isn't a perfect solution as it displays the added lines in a different format to the diff.
Update
However a better solution, which now seems obvious, has just occurred to me. When creating a new file, first check it in to CVS blank, then check it in again with the code, so I can do something like...
cvs diff -r1.1 -r1.2 ./somefile.php