Differences between revisions 1 and 2
Revision 1 as of 2014-08-01 08:14:10
Size: 721
Editor: Josip Medved
Comment:
Revision 2 as of 2014-08-02 06:18:15
Size: 1675
Editor: Josip Medved
Comment: Updated for new version.
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
Line 16: Line 17:
Line 18: Line 20:
Following commands are added: This extension will modify all Unicode files with BOM (byte order mark) and
convert them to BOM-less UTF-8. This comes especially handy when dealing with
Microsoft's Visual Studio that is really UTF-8 BOM happy.
Line 20: Line 24:
 * `hg checkbom` to see if there are files starting with UTF-8 BOM.
 * `hg killbom` to remove any UTF-8 BOM found.
Extensions adds two commands (`killbom`, `checkbom`) and hooks into the commit
process.
Line 25: Line 29:
Configure your .hgrc to enable the extension by adding following lines:
To use it just add following in the `hgrc` or global Mercurial settings file:
Line 28: Line 33:
[extensions]
killbom = /path/to/killbom.py
    [extensions]
    killbom = /path/to/killbom.py
    
    [killbom]
    extensions = utf-8 utf-16le utf-16be utf-32le utf-32be
    maxsize = 1024
Line 31: Line 40:


== Usage ==

Using `killbom` command will remove Unicode COM from all modified and newly
added files:

{{{
    hg killbom [options]
    
    options:
       -8 --utf8only removes only UTF-8 BOM signature
}}}


To just verify whether all files are BOM free, you would use `checkbom` command:

{{{
    hg checkbom [options]
    
    options:
       -8 --utf8only checks for only UTF-8 BOM signature
}}}


In addition there are three hooks. On `pretxncommit` and `pretxnchangegroup`
extension will verify whether all Unicode files are BOM-free and it will stop
commit if they are not. On `precommit` extension will modify files and remove
BOM.

KillBom

This extension will remove the BOM from all UTF-8 encoded files. Resulting file will still be UTF-8 but without the pesky BOM bytes.

1. Status

This extension is not distributed with Mercurial.

Author: Josip Medved

Repository: https://bitbucket.org/jmedved/hg-killbom

2. Overview

This extension will modify all Unicode files with BOM (byte order mark) and convert them to BOM-less UTF-8. This comes especially handy when dealing with Microsoft's Visual Studio that is really UTF-8 BOM happy.

Extensions adds two commands (killbom, checkbom) and hooks into the commit process.

3. Configuration

To use it just add following in the hgrc or global Mercurial settings file:

    [extensions]
    killbom = /path/to/killbom.py
    
    [killbom]
    extensions = utf-8 utf-16le utf-16be utf-32le utf-32be
    maxsize = 1024

4. Usage

Using killbom command will remove Unicode COM from all modified and newly added files:

    hg killbom [options]
    
    options:
       -8 --utf8only  removes only UTF-8 BOM signature

To just verify whether all files are BOM free, you would use checkbom command:

    hg checkbom [options]
    
    options:
       -8 --utf8only  checks for only UTF-8 BOM signature

In addition there are three hooks. On pretxncommit and pretxnchangegroup extension will verify whether all Unicode files are BOM-free and it will stop commit if they are not. On precommit extension will modify files and remove BOM.

5. See also


CategoryExtensionsByOthers

KillBomExtension (last edited 2014-08-04 04:35:55 by Josip Medved)