I suddenly have a few files that show as modified, but KDiff says they are binary equal. Reverting and discarding those changes does nothing.
Somehow, the eol extension is enabled and when I try to disable it, I can't view that one repo's Working Directory in TortoiseHg. An error appears:
[Error 6] The handle is invalid
When using the command line hg status, this error appears:
'cleverencode:' is not recognized as an internal or external command,
operable program or batch file.
When using hg revert myfile, .orig files are generated but the files still appear as modified and the same error from above appears.
When updating to a previous commit, a whole lot of other files get in the same situation like those few I have now.
If necessary, I can throw away this clone and make a new clone, but it would be nice if this can be resolved without doing so.
Was able to solve it.
My global mercurial.ini had some lines with cleverencode in them. After removing those, the issue has disappeared. Enabling/disabling the eol extension also doesn't seem to cause any issues any more.
I suspect the troublemaker was Atlassian's SourceTree, I had installed an update yesterday and it asked if automatic line ending handling should be enabled. I'm quite sure I unchecked it, regardless, it seems to have mixed eol config with win32text config.
See also: [SRCTREEWIN-708] Possible error with Mercurial line ending handling configuration - Atlassian JIRA
I found that the cleverencode did not work for me -- I didn't have it in my mercurial.ini. My case was also a binary file that mysteriously got marked as modified and would not go away with revert, clean, etc...
I did some poking around and fixed it: there's a repo/.hg/largefiles directory. I believe mercurial keeps this as a local cache of binary files in order to revert back changes. In this directory you'll see a bunch of file names in hex. In TortoiseHg "browse" your binary file causing the problem. It'll show you the hex code corresponding to your binary. Find that file in the largefiles directory and delete it.
You should now be able to revert the file back to unchanged. I think mercurial uses the largefiles version to revert first. Then, when this version doesn't match the repo version it gets marked as modified (in my case my binary somehow got truncated to 0 length) and will never go away.
You can also just delete the largefiles dir altogether if you can't match the hex name. It will get recreated as needed. I think the only repercussion is that it's take longer to do some binary file operations since it will have to go to the server.
Related
I have a file that I've copied over the top of a file in my hg repo with xcopy. I've done this literally 1000's of times with different files and no issue. When I copy this specific file and try to commit, I get the 'nothing changed' message.
The file has definitely changed. If I open it in Notepad, make no changes and then resave it, mercurial recognizes the changes. If I open it in Notepad++, edit it, undo the edit and then save it, mercurial recognizes the changes.
If I restart the process (copying files into a new hg repo and committing), it fails at the same point every time. There is something about these files, but what? I thought it might be date modified as they were the exact same millisecond, but after editing my copied file to add 1 minute to the date modified, it still doesn't work.
What can cause this? What should I look for?
hg status
hg status -A
C file.txt
hg commit file.txt
nothing changed
On Windows, using Mercurial 2.2.2 with NO extensions enabled (inotify extension is known to cause a similar issue)
It appears that Mercurial (2.2.2 at least), only checks a file when it gets edited/replaced. It does this by checking the date modified. As my files had the exact same timestamp, it didn't check the contents.
When I edited the timestamp so it was different, that only changes the metadata and not the file itself. So Mercurial wasn't notified of the change, so it never looked and saw that the timestamp was different.
Solution: Changing the timestamp of the new file BEFORE copying the file (or copy it somewhere else, edit it, then copy to the repo) allows Mercurial to see the that the timestamp has changed and it will then check the contents for what's changed.
So the problem is that all developers need different settings for their local testing, but the settings file is part of the project (unlike the nbproject folder for example that we all ignore). I know about .htignore, but the filter only applies to files that are not part of the project.
If I forget the file, then this removes it from the "global" repository, where we have a "holder" version of the settings file.
Right now we just don't commit that file, but every now and then somebody forgets and pushes his own settings, which then are synced back to other developers and it's a constant pain. We just want to "automatically" not push that file. Is there a solution to this? Are we doing something wrong?
You could add a precommit hook that gives an error every time you try to commit this particular file.
To handle the case of developers that forget to setup such a hook, you can also add a serverside hook that will reject their push.
When I create a new repository, I can ask TortoiseHG to give me a .hgignore file. Is there a way that I can customise what that file will look like, rather than having to go and get one manually from somewhere every time?
It's an old question, put still popped up as the first result on google, so here is an update:
In the TortoiseHg settings under the tab TortoiseHg users can specify the path of a Repo Skeleton. You can put your predefined .hgignore there, and it will be automatically copied during hg init.
See also:
#3569 Allow user-defined default .hgignore file when creating a new repository
TortoiseHG Docs
Like Tim already said in his comment, apparently it's not possible to do this.
Take a look at the following issue from TortoiseHG's bug tracker:
#966 Include some reasonable defaults in .hgignore on repo creation
Quotes from this link, both by Steve Borho (THG project lead):
This topic comes up on the Mercurial mailing list once a year or so and Matt always shoots it down. There is already support for user level ignore files; one could add these globs to a global file and be done with it.
and:
If a user has files or directories that they always want to ignore, they can add those to a global ignore file without having to introduce any new behaviors in THG.
So putting the things you always want ignored in a user-global ignore file seems to be the only option (even though it's not exactly what you're asking for):
Would like to create some defaults for my .hgignore files in TortoiseHG/Mercurial
(the question that I posted in my comment above)
Global hgignore usage
I want mercurial to ignore my own local copy of log/development.log (I am on RoR).
I used "hg forget filename" to forget the file, and then committed that change.
It seems to be successful now.. but every time I merge with other changesets now, I see
remote changed log/development.log which local deleted
use (c)hanged version or leave (d)eleted?
what am I doing wrong? how can I make this msg go away? I just want my local copy to be separate from the copy in the repository.
Thank you...
If you deleted the file in your line, and you merge it with the one that still has this file, this message is to be expected. The only way to get rid of it is to remove this file from the repos/branches you're merging with (or get their owners to remove it, if you don't control them).
And then never commit a temporary log file into the repository ever again.
I'm using TortoiseHG and am trying to handle a renamed file. Unfortunately, I accidentally clicked Accept Match for one of the files and want to undo it. How do I do so without hurting the files I'm trying to commit?
In the commit dialog you can right-click on the added file, and select forget. Then the file is no longer marked as copy. When you want the file in the commit, you can add this file again.
I'm not sure what's different but for me, there is no "forget" option in this situation.
What worked for me is choosing "revert" on the added file (the one marked as 'A'). This removes the rename, but also restores the original file. (If you renamed asdf.txt to fdsa.txt you will now have two files with those names.)
You then have to manually delete the restored file, and you should be back where you started. Note that I find it's safer to delete files with Windows file explorer, since they will end up in the recycle bin. Files deleted from thg are deleted permanently.