Block binary files?

Douglas Philips dgou at mac.com
Tue Jul 15 09:36:04 CDT 2008


On or about 2008 Jul 15, at 9:19 AM, Paul Steiner indited:
> I have a normal pc with windows xp.
> When i give the command ''hg add'' ... I wanna add all, but no  
> binary files.
> Add single files take to much time.
> So how can i block a file type (especial binary files)? Or it isn't  
> possible?

What is a binary file? Mercurial has no such concept.
If you have certain file name patterns (*.exe, *.pdf, etc.) you can  
use .hgignore.
But detecting binary files from their contents is a known hard problem.
For example, the extension for doing windows line-ending conversions  
is fooled by the .PDF files I have because the .PDFs don't have a  
null(0) early enough in the file. And that is just a heuristic to  
start with.

You could also use a hook that would refuse to commit files over a  
certain size, if that would help...

Your problem as stated is under-specified, since "binary file" is  
inherently under-specified. :)

--Doug



More information about the Mercurial mailing list