Is there a way to ignore 'files exceeded a filesize limit' in mercurial? Everytime I add a PDF, the push becomes very long in my project and I can't remove the file completely from the repository. Is there a way to remove the history for a single file in Mercurial?
Have a look at this question, it gives you an idea for a solution... to write a pre-commit hook to check the filesize.
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.
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.
Is there a way to mark a file; not a commit or should I say, not the whole commit; but only some file within some commit in Mercurial?
Apart from the method of just writing the name of the file in the commit message, of course.
Right, let's make an attempt at an answer, based on the info provided.
Mercurial is not a file-based VCS, it's change-based VCS. In other words it doesn't know that you changed fileA or fileB, all it know is that you made a changeset X. So there is, unfortunately, no way to "mark" a particular file.
As an alternative solution I'd suggest creating a "tag" (see here) on currently commited/pushed changeset when you send out a file, maybe formatting tagname to identify the file you have sent out.
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.