Mercurial status not showing modified files - mercurial

I'm running Mercurial 1.6.4 on my Debian server. It is not showing modified files that I know have been modified.
I'll modify a file, and an hg status will show:
! filename.txt
Then I run an hg status again and nothing shows up. I've tried to check in a file I know was modified, and alas, Mercurial says nothing was changed.
I even ran a hg st --all | grep 'M ' and it shows the modified files! Yet I can't check them in.

You should double-check that the inotify extension has not been enabled without your knowledge. Some older Debian packaged enabled it by default in the system-wide config. Use
hg showconfig --debug extensions
to list the enabled extensions and to list where each setting is read from. If it is enabled, you can disable it by adding
[extensions]
inotify = !
to your ~/.hgrc file or by editing the global config file.

I've tried to check in a file I know
was modified, and alas, Mercurial says
nothing was changed.
If you 'check it in', ie: commit, then status will not show it as modified because it has not been modified since the last commit.

Related

mercurial update leads to abort (filename too long)

After creating a symlink to a file I checked the file into my repo and it worked fine up to the point when I shared the repo with my teammate who is using Windows (his code goes into branch 'devui', mine is on the default branch).
If I switch from his latest changes (being on branch 'devui') to my default branch using hg upd default I get this message:
abort: could not symlink to '...<complete contents of symlinked file here>...':
File name too long: <symlink-filename>
This occurs after about half of the checkout so only a part of the files will be updated and the rest of the files (after the abort) is missing.
I also tried a fresh clone and hg upd -C default leading to the same result. In the moment my 'default' branch is in an unusable state and I cannot get back to my branch. I can get back to the revision before the 'devui'-branch was created though.
So my question is: Is it possible to skip the bad symlink, ignoring the abort and continue with the rest of the files? (I could recover that file easily).
I'm using mercurial 2.3 on MacOSX (via brew).
Thanks for your help.
This thread from 2010 (much older version of mercurial) suggests cloning the repo on a windows box, which may be unaffected by the problem, and reverting the symlink there.

Setting username in Mercurial .hgrc file

I have been browsing SO and Google for a solution to my basic problem, and so far I have had no luck.
I am brand new to Mercurial and have just installed it on my Mac. I am using it for personal version control and will not be communicating with a central server (yet).
When I try to commit files, I get abort: no username supplied (see "hg help config"). The common solution to this problem is putting the following in ~/.hgrc
[ui]
username = Firstname Lastname <firstname.lastname#example.net>
which I have done, but the error remains. It just won't read the file. Any suggestions?
For future reference: use
$ hg showconfig ui --debug
to see the settings from the [ui] section and to see the files Mercural reads for configuration settings. That should help you along if you ever have to debug such a case again.

Problem with loading hggit extension in TortoiseHG

I'm trying to get the hggit extension to work under Windows 7 (64bit) using TortoiseHG (2.1.2). I followed the official setup instructions, i.e. cloning the hg-git repository and adding the "hggit = ..." line to the extensions section in my mercurial.ini file.
However the extension doesn't seem to be loaded. When trying to clone a repository I get the following error :
abort: repository git://... not found!
running
hg help hggit
results in
hg: unknown command 'hggit'
I also don't get any errors at all, no matter what I put in the extensions section of the mercurial.ini file.
Any ideas on what the problem might be ? Are there any log files at all that show me whether there are problems loading the extensions ?
Had the same problem, and in my case I forgot to specify the [extensions] line in the INI file.
Not working:
[ui]
username = My name <my#emailaddress.com>
hgsubversion=D:\Repotools\hg-svn\hgsubversion
hggit=D:\Repotools\hg-git\hggit
Working:
[ui]
username = My name <my#emailaddress.com>
[extensions]
hgsubversion=D:\Repotools\hg-svn\hgsubversion
hggit=D:\Repotools\hg-git\hggit
When you run the command hg help hggit it will report if the directory path is incorrect.
You should include what you have after hggit =
It should be pointing to the hggit subdirectory in the directory you cloned the repository into.
e.g. hggit=C:\hg-extensions\hg-git\hggit

How does Mercurial tell a file was modified?

How does Mercurial tell a file was modified?
The reason I am asking is because when I run hg status its telling me several files are modified.
However, when I run hg diff there are no changes to report.
I have a theory as why this is happening: (but I am not positive)
I am using NetBeans which has Mercurial support built in. When I edit a file, it shows it as modified, although if I undo (rather than revert) those changes and save it, NetBeans tells me there are no local changes. So I am guessing NetBeans uses diffs to check for modifications while Mercurial is using something else like modification-date.
Is this correct or is something else the cause?
Mercurial does not use modification date to determine the status. This can be verified with a simple experiment:
hg init
echo "This is a test" > test.txt
hg commit -Am "commit"
touch test.txt
hg status
The code which performs the status check is in dirstate.py. If the dirstate is unsure about a file's status (e.g. because only the modification time differs, then it passes it up to localrepo.status for further analysis as seen here.
The hg help status text has some clues that may help:
status may appear to disagree with
diff if permissions have changed or a
merge has occurred. The standard diff
format does not report permission
changes and diff only reports changes
relative to one merge parent.
When you run hg diff, are you specifying any command-line options?
Is it possible the permissions of the file changed? Try hg diff --git which shows the git-style extended diffs that support permissions and binaries. By default hg diff shows only patch-friendly diffs, which don't show permissions changes.

Mercurial - How to remove a file from version control?

So I accidentally included a config file (different for each machine) into our mercurial repositories.
How can I get Mercurial to not include it in version control? I don't want to delete the file since I still want it. And I don't want to cause the file to get deleted on other developer's working directories either.
And how do I do this in TortoiseHG?
Right click on the file -> TortoiseHG -> Forget Files. Click Forget. Commit and Sync.
Edit:
You'll also want to add the path to your .hgignore to keep it from getting added again. You can right click on the file in the HG Commit dialog and choose to ignore it.
Here's the manual way of doing it through the command line:
Copy the config file somewhere outside of the repository.
Run hg rm path/to/config/file
Add the config file path to your .hgignore.
Commit the repository.
Move the config file back to where you had it.
Do an hg stat on your repository to double check you did everything right. (It shouldn't show up in the list of modified/added files).
Edit:
hg forget is the best way to do this.
Run hg forget path/to/config/file
Edit your .hgignore and add the path to the config file.
hg ci to save your changes.
Run hg stat to ensure everything worked according to plan.
See nates answer for how to do it TortoiseHG.
hg remove or hg remove -f?
I think hg forget also removes it from the branch.
In both cases, files are retained in your directory.
For those using SourceTree, there is an option Stop Tracking when you right click a file, it basically does the same thing as hg forget or git rm --cache, removing the file from repo but not from hard disk.
add it to your ignore list.
See the .hgignore file.
TortoiseHG gives you access to this config file via the "Edit Ignore Filter" menu option.